From e5b89a441af23a74b861b0bf8db3239139041876 Mon Sep 17 00:00:00 2001 From: slaren Date: Wed, 27 Mar 2024 15:07:50 +0100 Subject: [PATCH] ggml : fix bounds checking of zero size views (#6347) --- ggml.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ggml.c b/ggml.c index eb469d0f7..81100e277 100644 --- a/ggml.c +++ b/ggml.c @@ -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) {