Skip to content

Commit 675a08c

Browse files
authored
ggml-alloc: fix out-of-bounds read in ggml_dyn_tallocr_remove_block (#1492)
1 parent a7b7420 commit 675a08c

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/ggml-alloc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ static void ggml_dyn_tallocr_insert_block(struct tallocr_chunk * chunk, size_t o
150150

151151
static void ggml_dyn_tallocr_remove_block(struct tallocr_chunk * chunk, int idx) {
152152
// shift all elements after idx by 1 to the left, overwriting the element at idx
153-
for (int i = idx; i < chunk->n_free_blocks; i++) {
153+
for (int i = idx; i < chunk->n_free_blocks - 1; i++) {
154154
chunk->free_blocks[i] = chunk->free_blocks[i+1];
155155
}
156156
chunk->n_free_blocks--;

0 commit comments

Comments
 (0)