COMPMID-3926: Floor CTS failing in Neon
authorMichele Di Giorgio <michele.digiorgio@arm.com>
Thu, 29 Oct 2020 15:32:45 +0000 (15:32 +0000)
committerMichele Di Giorgio <michele.digiorgio@arm.com>
Fri, 30 Oct 2020 16:58:36 +0000 (16:58 +0000)
Depending n the value of `len`, the left-over loop might end up
writing/reading out-of-bounds, therefore corrupting the memory.

Change-Id: I1b0bb300f3e5ea668b585266e1aa6af7f93a5d1e
Signed-off-by: Michele Di Giorgio <michele.digiorgio@arm.com>
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/4290
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Manuel Bottini <manuel.bottini@arm.com>
Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>

src/core/NEON/kernels/floor/impl/fp16_neon_floor.cpp
src/core/NEON/kernels/floor/impl/fp32_neon_floor.cpp

index 3222fa926af7fb3cfd2b923bf5b04fc1aabd6bea..f0d9efb0505de11eb9ae9d3e79242b1c1ac20dbd 100644 (file)
@@ -53,7 +53,7 @@ void fp16_neon_floor(const void *src, void *dst, int len)
         pdst += step;
     }
 
-    for(; len >= 0; --len)
+    for(; len > 0; --len)
     {
         *pdst++ = std::floor(*psrc++);
     }
index dba61e1e8c9aca1774ee7807208b3f30f131f954..7a99988e02cf58339227029b062c7348aa4284b6 100644 (file)
@@ -51,7 +51,7 @@ void fp32_neon_floor(const void *src, void *dst, int len)
         pdst += step;
     }
 
-    for(; len >= 0; --len)
+    for(; len > 0; --len)
     {
         *pdst++ = std::floor(*psrc++);
     }