From 05aaeb01bffa83c0ee59bf3273785a473c1047d1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EC=98=A4=ED=98=95=EC=84=9D/On-Device=20Lab=28SR=29/Staff?= =?utf8?q?=20Engineer/=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Mon, 14 Jan 2019 19:39:59 +0900 Subject: [PATCH] Fix permute vaildation check bug (#4226) Fix permute validation check to check validate rank only Signed-off-by: Hyeongseok Oh --- libs/ARMComputeEx/src/core/CL/kernels/CLPermuteExKernel.cpp | 3 ++- runtimes/pure_arm_compute/src/internal/arm_compute/Cast.cc | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/libs/ARMComputeEx/src/core/CL/kernels/CLPermuteExKernel.cpp b/libs/ARMComputeEx/src/core/CL/kernels/CLPermuteExKernel.cpp index 8678cce..1e0468b 100644 --- a/libs/ARMComputeEx/src/core/CL/kernels/CLPermuteExKernel.cpp +++ b/libs/ARMComputeEx/src/core/CL/kernels/CLPermuteExKernel.cpp @@ -46,8 +46,9 @@ Status validate_arguments(const ITensorInfo *input, const ITensorInfo *output, "Permutation upto 4-D input tensor is supported"); ARM_COMPUTE_RETURN_ERROR_ON_MSG(perm.num_dimensions() < 1 || perm.num_dimensions() > 4, "Permutation vector size should be less than or equal to 4"); - for (const auto &p : perm) + for (unsigned int i = 0; i < perm.num_dimensions(); ++i) { + auto &p = perm[i]; ARM_COMPUTE_RETURN_ERROR_ON_MSG(p >= perm.num_dimensions(), "Permutation vector has invalid values"); } diff --git a/runtimes/pure_arm_compute/src/internal/arm_compute/Cast.cc b/runtimes/pure_arm_compute/src/internal/arm_compute/Cast.cc index 46e3925..d75a3ad 100644 --- a/runtimes/pure_arm_compute/src/internal/arm_compute/Cast.cc +++ b/runtimes/pure_arm_compute/src/internal/arm_compute/Cast.cc @@ -52,7 +52,9 @@ assert(rank <= 4); assert(runtime_pv != nullptr); - int new_pv[4] = {0, 1, 2, 3}; + int new_pv[4] = { + 0, + }; ::arm_compute::Coordinates axises = getARMComputeAxises(rank); if (rank == 4) -- 2.7.4