Browse Source

Critical fix from llama.cpp JSON grammar to forbid un-escaped escape characters inside strings, which breaks parsing. (#3782)

Craig Hughes 10 months ago
parent
commit
b84aea1685
1 changed files with 1 additions and 1 deletions
  1. 1 1
      llm/server.go

+ 1 - 1
llm/server.go

@@ -606,7 +606,7 @@ array  ::=
 
 
 string ::=
 string ::=
   "\"" (
   "\"" (
-    [^"\\] |
+    [^"\\\x7F\x00-\x1F] |
     "\\" (["\\/bfnrt] | "u" [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F]) # escapes
     "\\" (["\\/bfnrt] | "u" [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F]) # escapes
   )* "\"" ws
   )* "\"" ws