llama-gguf-hash malformed GGUF crash PoC
This repository contains minimal GGUF files for reproducing a NULL pointer dereference crash in llama-gguf-hash.
Files
| File | Purpose |
|---|---|
hash_empty_file.gguf |
Minimal malformed PoC. Empty file. |
hash_bad_magic.gguf |
Malformed PoC with invalid GGUF magic bytes. |
hash_truncated_header.gguf |
Malformed PoC with valid magic/version but truncated header. |
hash_valid_empty_control.gguf |
Valid empty GGUF control file. This should not crash. |
Reproduction
git clone https://github.com/ggml-org/llama.cpp.git
cd llama.cpp
cmake -B build -S . -DCMAKE_BUILD_TYPE=Release
cmake --build build -j"$(nproc)"
for F in \
/path/to/hash_empty_file.gguf \
/path/to/hash_bad_magic.gguf \
/path/to/hash_truncated_header.gguf \
/path/to/hash_valid_empty_control.gguf
do
echo
echo "FILE=$F"
timeout 8s ./build/bin/llama-gguf-hash "$F"
echo "[returncode] $?"
done
Observed result
Malformed files crash llama-gguf-hash with return code 139.
The valid empty GGUF control file exits normally.
hash_empty_file.gguf -> returncode 139
hash_bad_magic.gguf -> returncode 139
hash_truncated_header.gguf -> returncode 139
hash_valid_empty_control.gguf -> returncode 0
Root cause
llama-gguf-hash calls gguf_get_n_tensors(ctx) without checking whether gguf_init_from_file() returned NULL.
struct gguf_context * ctx = gguf_init_from_file(fname.c_str(), params);
const int n_tensors = gguf_get_n_tensors(ctx);
When parsing fails, ctx is NULL, causing a NULL pointer dereference.
- Downloads last month
- -
Hardware compatibility
Log In to add your hardware
We're not able to determine the quantization variants.
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐ Ask for provider support