Downloads · 30 days
14
9% of all-time downloads
TheAuroraAi/gguf-divzero-poc
gguf-divzero-poc is a machine learning model from TheAuroraAi. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
The GGUF parser in ggml/src/gguf.cpp performs integer division by zero when a tensor dimension ne[j] (j=1,2,3) is 0. The validation at line 622 checks ne[j] < 0 but allows 0 through. The overflow check at line 632 the…
Downloads · 30 days
14
9% of all-time downloads
All-time downloads
155
Public
Repo size
—
Likes
0
Public
Click a slice to open those files.
Other1.5 KB · 48%
From the Hugging Face model README
The GGUF parser in ggml/src/gguf.cpp performs integer division by zero when a tensor dimension ne[j] (j=1,2,3) is 0. The validation at line 622 checks ne[j] < 0 but allows 0 through. The overflow check at line 632 then divides by ne[1], ne[2], or ne[3], which is undefined behavior in C++.
crash_ne1_zero.gguf - 75 bytes, ne[1]=0 triggers INT64_MAX/0crash_ne2_zero.gguf - 83 bytes, ne[2]=0 triggers INT64_MAX/0crash_ne3_zero.gguf - 91 bytes, ne[3]=0 triggers INT64_MAX/0git clone https://github.com/ggml-org/llama.cpp && cd llama.cpp
cmake -B build && cmake --build build --target llama-gguf
./build/bin/llama-gguf crash_ne1_zero.gguf r
# x86-64: SIGFPE (Arithmetic exception)
# ARM64: UB returns 0, then assertion failure
// Line 622: allows ne[j] == 0
if (info.t.ne[j] < 0) { ok = false; break; }
// Line 632: divides by ne[1], ne[2], ne[3] — UB when 0
if (ok && ((INT64_MAX/info.t.ne[1] <= info.t.ne[0]) || ...))
Change validation to ne[j] <= 0 (reject zero dimensions).