From 3ae323f941f55cf282caa75dffa5150dd975b321 Mon Sep 17 00:00:00 2001 From: Gian Marco Iodice Date: Tue, 13 Aug 2019 14:56:50 +0100 Subject: COMPMID-2580: Fix out of bound read in Depthwise Convolution layer (OpenCL) Change-Id: I00e39ed21cc30034aa10ac58b64d533e833eafc8 Signed-off-by: Gian Marco Iodice Reviewed-on: https://review.mlplatform.org/c/1727 Reviewed-by: Michele Di Giorgio Tested-by: Arm Jenkins --- src/core/CL/kernels/CLDepthwiseConvolutionLayer3x3NCHWKernel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core/CL/kernels/CLDepthwiseConvolutionLayer3x3NCHWKernel.cpp') diff --git a/src/core/CL/kernels/CLDepthwiseConvolutionLayer3x3NCHWKernel.cpp b/src/core/CL/kernels/CLDepthwiseConvolutionLayer3x3NCHWKernel.cpp index fe796e96b8..c91dcece80 100644 --- a/src/core/CL/kernels/CLDepthwiseConvolutionLayer3x3NCHWKernel.cpp +++ b/src/core/CL/kernels/CLDepthwiseConvolutionLayer3x3NCHWKernel.cpp @@ -179,7 +179,7 @@ std::pair validate_and_configure_window(ITensorInfo *input, ITen num_elems_written_per_iteration_x = 8 / data_size_from_type(input->data_type()); num_elems_written_per_iteration_y = (is_qasymm && conv_stride_y == 1 && dilation.y() == 1) ? 2 : 1; - num_elems_read_per_iteration_x = 3 + (num_elems_written_per_iteration_x - 1) * conv_stride_x; + num_elems_read_per_iteration_x = 3 + (num_elems_written_per_iteration_x - 1) * conv_stride_x + (conv_stride_x > 1 ? 1 : 0); num_elems_read_per_iteration_y = num_elems_written_per_iteration_y + 2; } num_elems_read_per_iteration_x += (num_elems_read_per_iteration_x - 1) * (dilation.x() - 1); -- cgit v1.2.1