Skip to content

Commit 3c05f54

Browse files
committed
Avoid out of bounds access on invalid memory free
1 parent dee7c49 commit 3c05f54

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

driver/others/memory.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2882,9 +2882,10 @@ void blas_memory_free(void *free_area){
28822882
while ((position < NUM_BUFFERS) && (memory[position].addr != free_area))
28832883
position++;
28842884

2885-
if (memory[position].addr != free_area) goto error;
2885+
if (position >= NUM_BUFFERS) goto error;
28862886

28872887
#ifdef DEBUG
2888+
if (memory[position].addr != free_area) goto error;
28882889
printf(" Position : %d\n", position);
28892890
#endif
28902891

0 commit comments

Comments
 (0)