From f4edddb8968c6e424333a066cf6fbbf9c1426f13 Mon Sep 17 00:00:00 2001 From: Georgios Pinitas Date: Tue, 13 Apr 2021 09:53:04 +0100 Subject: Check data type lower bound when creating a tensor As underlying enum type can be an int we check also the lower bound of the data type when creating a tensor to avoid creation with negative values. Signed-off-by: Georgios Pinitas Change-Id: I00fa3cae988c5f20a56115b1c1b85b70e699c966 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/5413 Reviewed-by: Michele Di Giorgio Tested-by: Arm Jenkins Comments-Addressed: Arm Jenkins --- src/c/AclTensor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/c/AclTensor.cpp b/src/c/AclTensor.cpp index 58b17ff70e..0d884b1ec3 100644 --- a/src/c/AclTensor.cpp +++ b/src/c/AclTensor.cpp @@ -38,7 +38,7 @@ constexpr int32_t max_allowed_dims = 6; */ bool is_desc_valid(const AclTensorDescriptor &desc) { - if(desc.data_type > AclFloat32) + if(desc.data_type > AclFloat32 || desc.data_type <= AclDataTypeUnknown) { ARM_COMPUTE_LOG_ERROR_ACL("[AclCreateTensor]: Unknown data type!"); return false; -- cgit v1.2.1