From 4af94d9afe087a680fd1b42b7f74681db239024f Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Wed, 18 Mar 2026 12:39:19 +0200 Subject: [PATCH] gguf : fix division by zero --- ggml/src/gguf.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ggml/src/gguf.cpp b/ggml/src/gguf.cpp index cbeedf6c4b..d4656f5586 100644 --- a/ggml/src/gguf.cpp +++ b/ggml/src/gguf.cpp @@ -615,9 +615,9 @@ struct gguf_context * gguf_init_from_file_impl(FILE * file, struct gguf_init_par ok = ok && gr.read(info.t.ne[j]); } - // check that all ne are non-negative - if (info.t.ne[j] < 0) { - GGML_LOG_ERROR("%s: tensor '%s' dimension %" PRIu32 " has invalid number of elements: %" PRIi64 " < 0\n", + // check that all ne are positive + if (info.t.ne[j] <= 0) { + GGML_LOG_ERROR("%s: tensor '%s' dimension %" PRIu32 " has invalid number of elements: %" PRIi64 " <= 0\n", __func__, info.t.name, j, info.t.ne[j]); ok = false; break;