This repository contains a minimal differential reproduction for a native
heap-buffer-overflow read in Arm NN's TFLite MEAN parser.
1auto inputs = GetInputs(m_Model, subgraphIndex, operatorIndex);
2auto outputs = GetOutputs(m_Model, subgraphIndex, operatorIndex);
3CHECK_VALID_SIZE(outputs.size(), 1);
4
5TensorInfo inputTensorInfo = InputTensorInfo(subgraphIndex, operatorIndex, 0);
6TensorInfo dimTensorInfo = InputTensorInfo(subgraphIndex, operatorIndex, 1);
7...
8BufferRawPtr axisBufferPtr = GetBuffer(m_Model, inputs[1]->buffer);
1flatc -b schema.fbs control.json
2flatc -b schema.fbs trigger.json
1./harness control.tflite
2
3ASAN_OPTIONS=abort_on_error=1:detect_leaks=0 \
4UBSAN_OPTIONS=print_stacktrace=1:halt_on_error=1 \
5./harness trigger.tflite
1ERROR: AddressSanitizer: heap-buffer-overflow
2READ of size 4
3 #0 armnnTfLiteParser::TfLiteParserImpl::InputTensorInfo(...)
4 #1 armnnTfLiteParser::TfLiteParserImpl::ParseMean(...)
50x... is located 0 bytes after 4-byte region [0x...,0x...)
Three interleaved controls exited 0. Three triggers exited 134 with the same
sanitizer signature.
1878159da3215004fa2637014ab771ed6da5f62104bb347e15ffce2575bba69c9 control.tflite
2bb71a6fac73964af648219293e93e9a7586a1920a5b2cd4d9b35bfdb6f978750 trigger.tflite
Both files are 528 bytes.