Skip to content

Commit

Permalink
ggml : fix bounds checking of zero size views (llama/6347)
Browse files Browse the repository at this point in the history
  • Loading branch information
slaren authored and ggerganov committed Apr 6, 2024
1 parent 092c047 commit 40d3da9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ggml.c
Original file line number Diff line number Diff line change
Expand Up @@ -2938,7 +2938,7 @@ static struct ggml_tensor * ggml_new_tensor_impl(
data_size *= ne[i];
}

GGML_ASSERT(view_src == NULL || data_size + view_offs <= ggml_nbytes(view_src));
GGML_ASSERT(view_src == NULL || data_size == 0 || data_size + view_offs <= ggml_nbytes(view_src));

void * data = view_src != NULL ? view_src->data : NULL;
if (data != NULL) {
Expand Down

0 comments on commit 40d3da9

Please sign in to comment.