diff options
author | William Wilgus <wilgus.william@gmail.com> | 2024-12-25 12:37:23 -0500 |
---|---|---|
committer | William Wilgus <me.theuser@yahoo.com> | 2024-12-26 01:49:01 -0500 |
commit | 962e1b2e693c49c032ebfd1140eb05545ccaf32b (patch) | |
tree | 6a347664a7ce97a8a8983c658c9dc704d483e866 | |
parent | 1643e0e287797f99825322124a26c961cca7c6c3 (diff) | |
download | rockbox-962e1b2e69.tar.gz rockbox-962e1b2e69.zip |
[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
-rw-r--r-- | apps/plugins/test_mem.c | 6 |
1 files 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]; |