From 3c05f54df8de5df17507e80697d651e147e0bf69 Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Thu, 1 Oct 2020 10:48:45 +0200 Subject: [PATCH] Avoid out of bounds access on invalid memory free --- driver/others/memory.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/driver/others/memory.c b/driver/others/memory.c index 5c9c388ce..91cfefbd7 100644 --- a/driver/others/memory.c +++ b/driver/others/memory.c @@ -2882,9 +2882,10 @@ void blas_memory_free(void *free_area){ while ((position < NUM_BUFFERS) && (memory[position].addr != free_area)) position++; - if (memory[position].addr != free_area) goto error; + if (position >= NUM_BUFFERS) goto error; #ifdef DEBUG + if (memory[position].addr != free_area) goto error; printf(" Position : %d\n", position); #endif