]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commit
ggml/gguf : prevent integer overflows (#19856)
authorGeorgi Gerganov <redacted>
Tue, 24 Feb 2026 18:17:11 +0000 (20:17 +0200)
committerGitHub <redacted>
Tue, 24 Feb 2026 18:17:11 +0000 (20:17 +0200)
commit418dea39cea85d3496c8b04a118c3b17f3940ad8
tree5557b992f99f6f4b3f954c3cb46671fdd4b99cd1
parentda426cb25031928bcbc0d822bbd5ac3491ed4c13
ggml/gguf : prevent integer overflows (#19856)

* gguf : prevent integer overflow for ggml_context mem size

* ggml : fix int overflows in ggml_new_object()

* gguf : prevent string exhaustion

* gguf : prevent array elements exhaustion

* ggml : fix negative tensor type oob

* py : assert that alignment is non-zero power of 2

* ggml : check int overflow in ggml_new_tensor_impl and ggml_new_object

* gguf-py : error on duplicate keys when reading

* py : restore tensor_fields

* enforce proper alignment in add_custom_alignment

* gguf : better name

* gguf : fix ctx size for no_alloc == true

* gguf : minor print fix

* ggml : print values when overflow

* ggml : remove deprecated ggml_type_sizef()

* ggml : relax ggml_type asserts to debug-only

* gguf : add mem_size overflow test

* gguf : add file size check for arrays

* ggml : relax asseerts for ggml_get_type_traits()

* flake8 fix

---------

Co-authored-by: Sigbjørn Skjæret <redacted>
ggml/include/ggml.h
ggml/src/ggml.c
ggml/src/gguf.cpp
gguf-py/gguf/gguf_reader.py
gguf-py/gguf/gguf_writer.py
tests/test-gguf.cpp