summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchunseoklee <chunseoklee@naver.com>2020-09-08 20:05:02 +0900
committerChunseok Lee <chunseok.lee@samsung.com>2020-09-09 15:58:55 +0900
commit0d2787ea4bdc332168c313a3e56b424454d7acbd (patch)
tree28fcff5e2e094ff4bce73396a15a1e2cd5f2cd3c
parent74476a2d0296bdad70a2f7f90bc7419a8b05bffd (diff)
downloadnnfw-0d2787ea4bdc332168c313a3e56b424454d7acbd.tar.gz
nnfw-0d2787ea4bdc332168c313a3e56b424454d7acbd.tar.bz2
nnfw-0d2787ea4bdc332168c313a3e56b424454d7acbd.zip
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 <chunseok.lee@samsung.com>
-rw-r--r--compute/ARMComputeEx/src/runtime/CL/functions/CLReduceOperation.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/compute/ARMComputeEx/src/runtime/CL/functions/CLReduceOperation.cpp b/compute/ARMComputeEx/src/runtime/CL/functions/CLReduceOperation.cpp
index 38401100c..321d5c5fc 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<CLTensor[]>(num_of_interm_tensors);
_reduce_kernels = support::cpp14::make_unique<CLReduceOperationKernel[]>(num_of_kernels);