From 7b94c3e3bb88a9ad69178af0396f908b5833e2ea Mon Sep 17 00:00:00 2001 From: Georgios Pinitas Date: Mon, 14 May 2018 12:47:59 +0100 Subject: COMPMID-1139: Fix SIGSEGV in arm_compute_benchmark Invalid boundary checks. Change-Id: I9c346dc15d2080f710b283364e83831fa3466941 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/131029 Tested-by: Jenkins Reviewed-by: Gian Marco Iodice Reviewed-by: Anthony Barbier --- src/core/NEON/kernels/NEPoolingLayerKernel.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/core/NEON/kernels/NEPoolingLayerKernel.cpp') diff --git a/src/core/NEON/kernels/NEPoolingLayerKernel.cpp b/src/core/NEON/kernels/NEPoolingLayerKernel.cpp index be706e2e83..7877cf5cc0 100644 --- a/src/core/NEON/kernels/NEPoolingLayerKernel.cpp +++ b/src/core/NEON/kernels/NEPoolingLayerKernel.cpp @@ -2143,14 +2143,14 @@ void NEPoolingLayerKernel::poolingMxN_f16_nhwc(const Window &window_input, const for(int y = 0; y < pool_size_y; ++y) { - if(y + idx_height > window_input.z().end() || y + idx_height - pool_pad_top < window_input.z().start()) + if(y + idx_height - pool_pad_top >= window_input.z().end() || y + idx_height - pool_pad_top < window_input.z().start()) { continue; } for(int x = 0; x < pool_size_x; ++x) { - if(x + idx_width > window_input.y().end() || x + idx_width - pool_pad_left < window_input.y().start()) + if(x + idx_width - pool_pad_left >= window_input.y().end() || x + idx_width - pool_pad_left < window_input.y().start()) { continue; } @@ -2374,14 +2374,14 @@ void NEPoolingLayerKernel::poolingMxN_f32_nhwc(const Window &window_input, const for(int y = 0; y < pool_size_y; ++y) { - if(y + idx_height > window_input.z().end() || y + idx_height - pool_pad_top < window_input.z().start()) + if(y + idx_height - pool_pad_top >= window_input.z().end() || y + idx_height - pool_pad_top < window_input.z().start()) { continue; } for(int x = 0; x < pool_size_x; ++x) { - if(x + idx_width > window_input.y().end() || x + idx_width - pool_pad_left < window_input.y().start()) + if(x + idx_width - pool_pad_left >= window_input.y().end() || x + idx_width - pool_pad_left < window_input.y().start()) { continue; } @@ -2408,14 +2408,14 @@ void NEPoolingLayerKernel::poolingMxN_f32_nhwc(const Window &window_input, const vres = vdupq_n_f32(std::numeric_limits::lowest()); for(int y = 0; y < pool_size_y; ++y) { - if(y + idx_height > window_input.z().end() || y + idx_height - pool_pad_top < window_input.z().start()) + if(y + idx_height - pool_pad_top >= window_input.z().end() || y + idx_height - pool_pad_top < window_input.z().start()) { continue; } for(int x = 0; x < pool_size_x; ++x) { - if(x + idx_width > window_input.y().end() || x + idx_width - pool_pad_left < window_input.y().start()) + if(x + idx_width - pool_pad_left >= window_input.y().end() || x + idx_width - pool_pad_left < window_input.y().start()) { continue; } @@ -2571,14 +2571,14 @@ void NEPoolingLayerKernel::poolingMxN_qasymm8_nhwc(const Window &window_input, c // Perform pooling for(int y = 0; y < pool_size_y; ++y) { - if(y + idx_height > window_input.z().end() || y + idx_height - pool_pad_top < window_input.z().start()) + if(y + idx_height - pool_pad_top >= window_input.z().end() || y + idx_height - pool_pad_top < window_input.z().start()) { continue; } for(int x = 0; x < pool_size_x; ++x) { - if(x + idx_width > window_input.y().end() || x + idx_width - pool_pad_left < window_input.y().start()) + if(x + idx_width - pool_pad_left >= window_input.y().end() || x + idx_width - pool_pad_left < window_input.y().start()) { continue; } @@ -2606,14 +2606,14 @@ void NEPoolingLayerKernel::poolingMxN_qasymm8_nhwc(const Window &window_input, c for(int y = 0; y < pool_size_y; ++y) { - if(y + idx_height > window_input.z().end() || y + idx_height - pool_pad_top < window_input.z().start()) + if(y + idx_height - pool_pad_top >= window_input.z().end() || y + idx_height - pool_pad_top < window_input.z().start()) { continue; } for(int x = 0; x < pool_size_x; ++x) { - if(x + idx_width > window_input.y().end() || x + idx_width - pool_pad_left < window_input.y().start()) + if(x + idx_width - pool_pad_left >= window_input.y().end() || x + idx_width - pool_pad_left < window_input.y().start()) { continue; } -- cgit v1.2.1