From 962e1b2e693c49c032ebfd1140eb05545ccaf32b Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Wed, 25 Dec 2024 12:37:23 -0500 Subject: [PATCH] [Bugfix, ASAN] test_mem plugin fix OOB read in read_test() asan correctly identified an out of bound read in the test_mem plugin This shouldn't cause any issue in normal use since the data isn't used Change-Id: I52acabc4649397f9dd2ba7979f9210529ced2071 --- apps/plugins/test_mem.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/plugins/test_mem.c b/apps/plugins/test_mem.c index 2c887539e9..3e5b8283b0 100644 --- a/apps/plugins/test_mem.c +++ b/apps/plugins/test_mem.c @@ -132,10 +132,10 @@ static void read_test(volatile int *buf, int buf_size, int loop_cnt) : "r0", "r1", "r2", "r3", "r4", "r5", "r6", "memory", "cc" ); #else - int x; - for(int i = 0; i < loop_cnt; i++) + int x, i, j; + for(i = 0; i < loop_cnt; i++) { - for(int j = 0; j < buf_size; j+=4) + for(j = 0; j < buf_size - 4; j+=4) { x = buf[j ]; x = buf[j+2];