From 0d2787ea4bdc332168c313a3e56b424454d7acbd Mon Sep 17 00:00:00 2001 From: chunseoklee Date: Tue, 8 Sep 2020 20:05:02 +0900 Subject: [PATCH] Fix coverity1148326 (#4131) Fix coverity defect : Integer overflowed argument ``` 6. overflow_sink: Overflowed or truncated value (or a value computed from an overflowed or truncated value) num_of_interm_tensors - 1U used as critical argument to function. [show details] _interm_tensors[num_of_interm_tensors - 1].allocator()->allocate(); ``` ONE-DCO-1.0-Signed-off-by: Chunseok Lee --- compute/ARMComputeEx/src/runtime/CL/functions/CLReduceOperation.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/compute/ARMComputeEx/src/runtime/CL/functions/CLReduceOperation.cpp b/compute/ARMComputeEx/src/runtime/CL/functions/CLReduceOperation.cpp index 3840110..321d5c5 100644 --- a/compute/ARMComputeEx/src/runtime/CL/functions/CLReduceOperation.cpp +++ b/compute/ARMComputeEx/src/runtime/CL/functions/CLReduceOperation.cpp @@ -120,6 +120,8 @@ void CLReduceOperation::configure(ICLTensor *input, ICLTensor *output, const size_t num_of_kernels = axis.size(); const size_t num_of_interm_tensors = num_of_kernels - (keep_dims ? 1 : 0); + ARM_COMPUTE_ERROR_ON(num_of_kernels < 1); + _interm_tensors = support::cpp14::make_unique(num_of_interm_tensors); _reduce_kernels = support::cpp14::make_unique(num_of_kernels); -- 2.7.4