]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commit
common/parser : fix out_of_range crash in throw path (#20424 regression) (#20777)
authorJames O'Leary <redacted>
Fri, 20 Mar 2026 01:37:22 +0000 (18:37 -0700)
committerGitHub <redacted>
Fri, 20 Mar 2026 01:37:22 +0000 (02:37 +0100)
commitc46583b86bed573c4ff30685dae59874f124e664
tree1d9f5a232bebf3e9d8a1befd8c85c273ce3a669d
parentc1b911654a581662c19eb51829705e4ed7020673
common/parser : fix out_of_range crash in throw path (#20424 regression) (#20777)

* chat : fix out_of_range crash in throw path (#20424 regression)

#20424 introduced effective_input = generation_prompt + input, but the
throw path uses input.substr(result.end) where result.end is a position
within effective_input. Every thinking model with a non-empty
generation_prompt crashes with std::out_of_range instead of the intended
error message.

Test crashes on unpatched master, passes with fix:

  cmake -B build -DLLAMA_BUILD_TESTS=ON -DLLAMA_BUILD_TOOLS=OFF
  cmake --build build --target test-chat
  ./build/bin/test-chat

* Update test-chat.cpp

* Update test-chat.cpp

* Update test-chat.cpp

---------

Co-authored-by: Piotr Wilkin (ilintar) <redacted>
common/chat.cpp
tests/test-chat.cpp