From ddb17eb9444c47df1b6a057dea8e77fb271d09a1 Mon Sep 17 00:00:00 2001 From: Omar Al Khatib Date: Tue, 17 Feb 2026 12:42:57 +0000 Subject: [PATCH] fix: Add index validation for batch_index in NECropKernel Resolves: [COMPMID-8702] Signed-off-by: Omar Al Khatib Change-Id: I04ed0560ebbb2424dd753fc2be1e0cac6da907bd --- src/core/NEON/kernels/NECropKernel.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/core/NEON/kernels/NECropKernel.cpp b/src/core/NEON/kernels/NECropKernel.cpp index 60271fbc74..cffc701348 100644 --- a/src/core/NEON/kernels/NECropKernel.cpp +++ b/src/core/NEON/kernels/NECropKernel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2022 Arm Limited. + * Copyright (c) 2019-2022, 2026 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -323,7 +323,10 @@ void NECropKernel::run(const Window &window, const ThreadInfo &info) const auto *uk = get_implementation(CropSelectorData{_input->info()->data_type()}); - uint32_t batch_index = *(reinterpret_cast(_box_ind->ptr_to_element(Coordinates(_crop_box_ind)))); + uint32_t batch_index = *(reinterpret_cast(_box_ind->ptr_to_element(Coordinates(_crop_box_ind)))); + ARM_COMPUTE_ERROR_ON(batch_index >= + _input->info()->tensor_shape()[3]); // Check if batch_index is outside the number of batches + Coordinates input_offset( 0, _end[0] < _start[0] ? _start[0] - _cols_out_of_bounds[0] : _start[0] + _cols_out_of_bounds[0], _end[1] < _start[1] ? _start[1] - _rows_out_of_bounds[0] : _start[1] + _rows_out_of_bounds[0], batch_index);