ggml : fix bounds checking of zero size views (llama/6347)

This commit is contained in:
slaren 2024-03-27 15:07:50 +01:00 committed by Georgi Gerganov
parent 700d146127
commit 3adbf2fb03
No known key found for this signature in database
GPG Key ID: 449E073F9DC10735

2
ggml.c
View File

@ -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) {