llama_cpp_for_radxa_dragon_.../common
Adrien e397d3885c
common/json-schema: fix: handle non-capturing groups (?:...) in JSON schema pattern converter (#21124)
The regex-to-grammar converter in _visit_pattern() crashes with SIGSEGV
when a JSON schema "pattern" field contains a non-capturing group (?:...).

Root cause: when the parser sees '(' followed by '?', it pushes a warning
but does not advance past '?:'. The recursive transform() call then
interprets '?' as a quantifier and calls seq.back() on an empty vector,
causing undefined behavior.

This commonly occurs when serving OpenAI-compatible tool calls from
clients that include complex regex patterns in their JSON schemas (e.g.,
date validation patterns like ^(?:(?:\d\d[2468][048]|...)-02-29|...)$).

The fix:
- Skip '?:' after '(' to treat non-capturing groups as regular groups
- For unsupported syntax (?=, ?!, etc.), skip to matching ')' safely,
  handling escaped characters to avoid miscounting parenthesis depth
- Adjust the ')' unbalanced-parentheses check using direct char
  comparisons instead of substr
- Add test cases for non-capturing groups (C++ only, as the JS/Python
  implementations do not yet support this syntax)
2026-03-28 17:55:38 +01:00
..
jinja jinja: fix macro with kwargs (#20960) 2026-03-25 12:22:48 +01:00
arg.cpp server : add custom socket options to disable SO_REUSEPORT (#21056) 2026-03-28 01:12:43 +01:00
arg.h
base64.hpp
build-info.cpp.in
chat-auto-parser-generator.cpp
chat-auto-parser-helpers.cpp
chat-auto-parser-helpers.h
chat-auto-parser.h
chat-diff-analyzer.cpp common/parser: fix reasoning whitespace bugs + extra parser tests (#21085) 2026-03-28 07:29:26 +01:00
chat-peg-parser.cpp
chat-peg-parser.h
chat.cpp common : add reasoning_format = none support to gpt-oss (#21094) 2026-03-28 09:33:39 -05:00
chat.h
CMakeLists.txt common : add standard Hugging Face cache support (#20775) 2026-03-24 07:30:33 +01:00
common.cpp cli : add /glob command (#21084) 2026-03-28 02:33:04 +01:00
common.h cli : add /glob command (#21084) 2026-03-28 02:33:04 +01:00
console.cpp
console.h
debug.cpp
debug.h
download.cpp common : filter out imatrix when finding models (#21023) 2026-03-26 15:37:18 +01:00
download.h common : add standard Hugging Face cache support (#20775) 2026-03-24 07:30:33 +01:00
hf-cache.cpp common : add getpwuid fallback for HF cache when HOME is not set (#21035) 2026-03-26 20:34:23 +01:00
hf-cache.h common : fix split model migration (#21019) 2026-03-26 12:04:37 +01:00
http.h
json-partial.cpp
json-partial.h
json-schema-to-grammar.cpp common/json-schema: fix: handle non-capturing groups (?:...) in JSON schema pattern converter (#21124) 2026-03-28 17:55:38 +01:00
json-schema-to-grammar.h
llguidance.cpp
log.cpp
log.h
ngram-cache.cpp
ngram-cache.h
ngram-map.cpp
ngram-map.h
ngram-mod.cpp
ngram-mod.h
peg-parser.cpp
peg-parser.h
preset.cpp
preset.h
reasoning-budget.cpp common : inhibit lazy grammar sampler while reasoning is active (#20970) 2026-03-27 18:30:40 +01:00
reasoning-budget.h common : inhibit lazy grammar sampler while reasoning is active (#20970) 2026-03-27 18:30:40 +01:00
regex-partial.cpp
regex-partial.h
sampling.cpp common : inhibit lazy grammar sampler while reasoning is active (#20970) 2026-03-27 18:30:40 +01:00
sampling.h
speculative.cpp
speculative.h
unicode.cpp
unicode.h