From df25859fe99ce721958d197534d6df11445b9d36 Mon Sep 17 00:00:00 2001 From: Mike Kelly Date: Mon, 26 Apr 2021 23:53:31 +0100 Subject: IVGCVSW-5940 Enabling NN Driver dumps results in a driver segfault * Added checks to SerializerStrategy::CreateTensorInfo to handle situations where a shape has some unspecified dimensions Signed-off-by: Mike Kelly Change-Id: Idc64bfdabd5677c73a5c64f0c8e80156f3aae8e2 --- src/armnnSerializer/Serializer.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/armnnSerializer/Serializer.cpp b/src/armnnSerializer/Serializer.cpp index b742cd87d8..944797fda3 100644 --- a/src/armnnSerializer/Serializer.cpp +++ b/src/armnnSerializer/Serializer.cpp @@ -1674,17 +1674,21 @@ flatbuffers::Offset SerializerStrategy::CreateTensorInfo(const armn { // Get the dimensions std::vector shape; - for(unsigned int dim = 0; dim < tensorInfo.GetShape().GetNumDimensions(); ++dim) - { - shape.push_back(tensorInfo.GetShape()[dim]); - } - std::vector specificity; // This assumes that the TensorShape constructors have ensured that the size of m_DimensionsSpecificity // matches the size of dimensions. for(unsigned int dim = 0; dim < tensorInfo.GetShape().GetNumDimensions(); ++dim) { specificity.push_back(tensorInfo.GetShape().GetDimensionSpecificity(dim)); + + if (tensorInfo.GetShape().GetDimensionSpecificity(dim)) + { + shape.push_back(tensorInfo.GetShape()[dim]); + } + else + { + shape.push_back(0); + } } if (tensorInfo.HasPerAxisQuantization()) -- cgit v1.2.1