← Lab
gguf0dim
confirmedupstream bugC++ · ggmlInference & servingJuly 13, 2026
the question
Does the ggml GGUF reader divide by a tensor dimension it never checked for zero?
what came out
Yes. The dimension gate rejects only ne<0, so a zero passes into INT64_MAX/ne[1] at gguf.cpp:681, a signed division by zero. On x86-64 that is a #DE fault and SIGFPE crash when loading an attacker .gguf; on AArch64/M4 sdiv returns 0 and the file is rejected by accident. A sanitizer confirms the UB at the exact line.
method & receipts
- Result: confirmed
- Pre-registered — the prediction was written down and committed before the run.
- Reproducible — one script re-runs the whole thing from scratch.
- Tested — a correctness/benchmark suite ships alongside the code.
→ read the code and re-run it
github.com/v-code01/gguf0dim