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

This commit is contained in:
slaren 2024-03-27 15:07:50 +01:00 committed by GitHub
parent 3a0345970e
commit e5b89a441a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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