]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commit
context: zero output buffer on allocation (#20781)
authorRuikai Peng <redacted>
Fri, 20 Mar 2026 09:31:34 +0000 (17:31 +0800)
committerGitHub <redacted>
Fri, 20 Mar 2026 09:31:34 +0000 (11:31 +0200)
commitdc6592431b909208040c1a8e953e6c5440471eaa
treed2e32e50ce32afcab2a76860919db2dea3f4115b
parent3adbef7776dff2a2ab2f0780d6c2fcad4dbff14b
context: zero output buffer on allocation (#20781)

* context: zero output buffer on allocation

Address GHSA-wqq9-25mr-rw76.

The logits output buffer allocated in output_reserve() uses
posix_memalign(), which does not zero memory. The buffer is only
written during decode when needs_raw_logits() returns true. When
backend samplers cover all output sequences, needs_raw_logits()
returns false and the buffer is never written, but
llama_get_logits() still returns a pointer to it, exposing stale
heap content.

Zero the buffer after allocation to prevent information disclosure
through the public logits API.

Found-by: Pwno
* Update src/llama-context.cpp

Co-authored-by: Georgi Gerganov <redacted>
---------

Co-authored-by: Georgi Gerganov <redacted>
src/llama-context.cpp