grammar: add test case for nullable symbol loop
Reproduce stack overflow (or OOM) with ( [x]* )* found while adding
GBNF support to ripgrep-edit.
llama-server reproducer:
curl \
-X POST \
-d '{
"messages": [{ "role": "user", "content": "write yes" }],
"grammar": "root ::= ( [x]* )*"
}' \
-H "Content-Type: application/json" \
http://localhost:8811/v1/chat/completions
This commit is contained in:
parent
b5fe4559ae
commit
1ea4e6d8f2
|
|
@ -784,6 +784,24 @@ static void test_quantifiers() {
|
|||
"0xFF 0x12 0xAB 0x00 0x00 0x00",
|
||||
}
|
||||
);
|
||||
test_grammar(
|
||||
"segfault",
|
||||
// Grammar
|
||||
R"""(
|
||||
root ::= ( [x]* )*
|
||||
)""",
|
||||
// Passing strings
|
||||
{
|
||||
"",
|
||||
"x",
|
||||
"xx"
|
||||
},
|
||||
// Failing strings
|
||||
{
|
||||
"y",
|
||||
"yy"
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
static void test_failure_missing_root() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue