Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions ggml/src/gguf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -672,9 +672,10 @@ static struct gguf_context * gguf_init_from_reader(const struct gguf_reader & gr
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 (zero-sized tensors are
// invalid and would divide by zero in the size checks below)
if (info.t.ne[j] <= 0) {
GGML_LOG_ERROR("%s: tensor '%s' dimension %" PRIu32 " must be positive, got %" PRIi64 "\n",
__func__, info.t.name, j, info.t.ne[j]);
ok = false;
break;
Expand Down