Views
No views yet
BatchToSpaceNd and
SpaceToBatchNd descriptors whose blockShape length exceeds the number of
crops or padList pairs. Normal graph optimization then iterates over every
block-shape entry and indexes the shorter paired vector without a bounds
check..armnn deserialization plus normal armnn::Optimize().2b61cecc9df7a43fca1463795062cf359e6be820CpuRefParseBatchToSpaceNd() validates only that the flat crops vector has an even
length. ParseSpaceToBatchNd() does the same for padList. Neither parser
requires:1blockShape.size() == crops.size() / 2
2blockShape.size() == padList.size() / 21for (unsigned int i = 0; i < m_Param.m_BlockShape.size(); ++i)
2{
3 unsigned int cropSize =
4 m_Param.m_Crops[i].first + m_Param.m_Crops[i].second;
5}1for (unsigned int i = 0; i < m_Param.m_BlockShape.size(); ++i)
2{
3 outputShape[spatialDimension] =
4 (inputShape[spatialDimension] +
5 m_Param.m_PadList[i].first +
6 m_Param.m_PadList[i].second) /
7 m_Param.m_BlockShape[i];
8}i == 1, the single-pair m_Crops or m_PadList vector is read
immediately beyond its eight-byte allocation../cyber/huntr-mfv/candidates/armnn-flatbuffers-batch-space-vector-mismatch-oob-read/reproduce.sh| Model | Result |
|---|---|
control-batch-to-space.armnn | exit 0, 0, 0 |
control-space-to-batch.armnn | exit 0, 0, 0 |
trigger-batch-to-space.armnn | ASan heap-buffer-overflow, exit 134, 134, 134 |
trigger-space-to-batch.armnn | ASan heap-buffer-overflow, exit 134, 134, 134 |
1armnn::BatchToSpaceNdLayer::InferOutputShapes(...) + 2832
2armnn::BatchToSpaceNdLayer::ValidateTensorShapesFromInputs()
3armnn::Graph::InferTensorInfos()
4armnn::Optimize(...)1armnn::SpaceToBatchNdLayer::InferOutputShapes(...) + 2788
2armnn::SpaceToBatchNdLayer::ValidateTensorShapesFromInputs()
3armnn::Graph::InferTensorInfos()
4armnn::Optimize(...)1d0a6dbde7dbcba4e59ae14d49151584da1fa41d4f0348e8065ffd26f9cc915d4 control-batch-to-space.armnn
28c7bfd08cd8a76c41b2b8f931f12e5f1453ebd328c148cfed4c61b4056685bd3 control-space-to-batch.armnn
3d8d55eef2c8cbcfc04669c45c8f32d5f9f0021735da890c17aa49d169957777d trigger-batch-to-space.armnn
4f0168e3cc41a396b764360e1f01bb092115084fd2f7782c4c0bc5c0fb7d2dee1 trigger-space-to-batch.armnn.armnn model can trigger a native heap
out-of-bounds read while the network is optimized, before inference.blockShape versus crops / padList mismatch. The public ParsePad
odd-padList occurrence is a different parser and input invariant.