A malformed GGUF v3 file containing a key-value metadata entry with an invalid type value (0x7fffffff) triggers UndefinedBehaviorSanitizer in llama.cpp's GGUF parser.
1ASAN_OPTIONS="abort_on_error=1:detect_leaks=0:symbolize=1" \
2UBSAN_OPTIONS="print_stacktrace=1:halt_on_error=1" \
3./build-asan/bin/llama-gguf invalid_kv_type_0x7fffffff.gguf r n
1ASAN_OPTIONS="abort_on_error=1:detect_leaks=0:symbolize=1" \
2UBSAN_OPTIONS="print_stacktrace=1:halt_on_error=1" \
3./build-asan/bin/llama-cli -m invalid_kv_type_0x7fffffff.gguf -p test -n 1
1runtime error: load of value 2147483647, which is not a valid value for type 'gguf_type'
2SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ggml/src/gguf.cpp
1key 'general.name' has invalid GGUF type 2147483647
2failed to read key-value pairs
This demonstrates undefined behavior in the GGUF parser when reading an invalid metadata type value from an untrusted GGUF file. In sanitized builds, loading the crafted file aborts the process. The PoC is local-only and contains no executable payload.