From f2ed1b84caccb05c9e00e18b2cb2d2a2875b43fd Mon Sep 17 00:00:00 2001 From: Teresa Charlin Date: Tue, 24 Nov 2020 15:11:54 +0000 Subject: IVGCVSW-5499 Missing validation for zero stride * Convolution * Depthwise Convolution Signed-off-by: Teresa Charlin Change-Id: I61b356fbffb176e9a05e08d9b6867d082b6712c8 --- src/armnn/layers/Convolution2dLayer.cpp | 3 +++ src/armnn/layers/DepthwiseConvolution2dLayer.cpp | 3 +++ 2 files changed, 6 insertions(+) (limited to 'src/armnn') diff --git a/src/armnn/layers/Convolution2dLayer.cpp b/src/armnn/layers/Convolution2dLayer.cpp index 26f11f3d0c..18557bf64e 100644 --- a/src/armnn/layers/Convolution2dLayer.cpp +++ b/src/armnn/layers/Convolution2dLayer.cpp @@ -89,6 +89,9 @@ std::vector Convolution2dLayer::InferOutputShapes(const std::vector // If we support multiple batch dimensions in the future, then this assert will need to change. ARMNN_ASSERT_MSG(inputShape.GetNumDimensions() == 4, "Convolutions will always have 4D input."); + ARMNN_ASSERT( m_Param.m_StrideX > 0); + ARMNN_ASSERT( m_Param.m_StrideY > 0); + DataLayoutIndexed dataLayoutIndex(m_Param.m_DataLayout); unsigned int inWidth = inputShape[dataLayoutIndex.GetWidthIndex()]; diff --git a/src/armnn/layers/DepthwiseConvolution2dLayer.cpp b/src/armnn/layers/DepthwiseConvolution2dLayer.cpp index 139d268631..ff9cebafd5 100644 --- a/src/armnn/layers/DepthwiseConvolution2dLayer.cpp +++ b/src/armnn/layers/DepthwiseConvolution2dLayer.cpp @@ -90,6 +90,9 @@ DepthwiseConvolution2dLayer::InferOutputShapes(const std::vector& i ARMNN_ASSERT_MSG(inputShape.GetNumDimensions() == 4, "Convolutions will always have 4D input."); + ARMNN_ASSERT( m_Param.m_StrideX > 0); + ARMNN_ASSERT( m_Param.m_StrideY > 0); + DataLayoutIndexed dataLayoutIndex(m_Param.m_DataLayout); unsigned int inputBatchSize = inputShape[0]; -- cgit v1.2.1