Arm NN TFLite BROADCAST_TO short-buffer heap over-read
Status: reproduced with ASan on current Arm NN; fresh prior-art gate open
Summary
Arm NN's TFLite parser trusts the declared element count of a
BROADCAST_TO shape tensor but does not verify that the tensor's backing
Buffer.data vector contains that many int32_t values.
A structurally valid 512-byte TFLite file can declare 1,024 shape elements
while supplying four bytes. ITfLiteParser::CreateNetworkFromBinary() passes
the FlatBuffers verifier, unpacks the model, and reads immediately beyond the
four-byte heap allocation during model loading.
The FlatBuffers verifier validates the Tensor.shape and Buffer.data
vectors independently. The TFLite schema does not couple their lengths, so the
canonical verifier accepts the proof before tflite::UnPackModel().
Both artifacts are generated by TensorFlow's official v2.19.0 TFLite schema.
They are the same size and differ only in the shape tensor metadata and backing
payload:
Artifact
Declared shape values
Buffer bytes
Result
control.tflite
2
8
Loads; exit 0
poc.tflite
1,024
4
ASan heap-buffer-overflow read; exit 134
Observed proof result:
text
1ERROR: AddressSanitizer: heap-buffer-overflow
2READ of size 4
30 bytes after 4-byte region
4armnnTfLiteParser::TfLiteParserImpl::ParseBroadcastTo
5armnnTfLiteParser::TfLiteParserImpl::CreateNetworkFromModel
6armnnTfLiteParser::TfLiteParserImpl::CreateNetworkFromBinary
The failing read is the second loop iteration: shapeData[1], immediately
after the one supplied int32_t.
Then an ASan heap-buffer-overflow read in ParseBroadcastTo().
Suggested fix
Before interpreting the byte vector as int32_t values:
Reject non-INT32 shape tensors.
Use checked multiplication for numElement * sizeof(int32_t).
Reject buffers smaller than the required byte count.
Consider rejecting trailing bytes or handling them consistently.
Add a regression test using the supplied one-value buffer with a declared
two-value shape tensor. The parser must throw ParseException before reading
the second element.
Novelty
Fresh exact and semantic searches on 2026-07-28 found:
0 matching Hugging Face repositories.
0 matching Arm NN GitHub issues or pull requests.
0 local matches before this candidate.
The closest public Arm NN TFLite disclosure is a BATCH_TO_SPACE_ND
out-of-bounds write. It names a different operator, root cause, and sink.
Other public Arm NN proofs cover native .armnn deserialization rather than
this TFLite BROADCAST_TO buffer-length mismatch.