grammar: add test case for hang in repetition grammar processing
This commit adds a new test case to the grammar integration tests that
specifically targets a hang scenario in the repetition grammar parser
found while adding GBNF support to ripgrep-edit.
llama-server reproducer:
curl \
-X POST \
-d '{
"messages": [{ "role": "user", "content": "write yes" }],
"grammar": "root ::= (([^x]*){0,99}){0,99}"
}' \
-H "Content-Type: application/json" \
http://localhost:8811/v1/chat/completions
Not security related according to
https://github.com/ggml-org/llama.cpp/security#untrusted-environments-or-networks
This commit is contained in:
parent
b689ff4779
commit
c537f77a4d
|
|
@ -802,6 +802,19 @@ static void test_quantifiers() {
|
|||
"yy"
|
||||
}
|
||||
);
|
||||
test_grammar(
|
||||
"hang",
|
||||
// Grammar
|
||||
R"""(
|
||||
root ::= (((((([^x]*){0,99}){0,99}){0,99}){0,99}){0,99}){0,99}
|
||||
)""",
|
||||
// Passing strings
|
||||
{
|
||||
},
|
||||
// Failing strings
|
||||
{
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
static void test_failure_missing_root() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue