summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorExtReMLapin <3909752+ExtReMLapin@users.noreply.github.com>2024-03-05 14:44:29 +0100
committerGitHub <noreply@github.com>2024-03-05 15:44:29 +0200
commitb1a4e994fde929300d4aeb1deb8320c59cb6edec (patch)
treeb7f8d8bbb17f803ef686eb80ec626bcc807c9b7e
parent61d1c88e155515dd03940913a5707ea84a8b119b (diff)
grammars : don't allow to output unescaped new line in string (#5885)
* Don't allow grammar json array to output unescaped new line in string * Don't allow new line in json object string
-rw-r--r--grammars/json.gbnf2
-rw-r--r--grammars/json_arr.gbnf2
2 files changed, 2 insertions, 2 deletions
diff --git a/grammars/json.gbnf b/grammars/json.gbnf
index a9537cdf..34e014d5 100644
--- a/grammars/json.gbnf
+++ b/grammars/json.gbnf
@@ -15,7 +15,7 @@ array ::=
string ::=
"\"" (
- [^"\\] |
+ [^"\\\n] |
"\\" (["\\/bfnrt] | "u" [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F]) # escapes
)* "\"" ws
diff --git a/grammars/json_arr.gbnf b/grammars/json_arr.gbnf
index ef53e77a..fd5740ee 100644
--- a/grammars/json_arr.gbnf
+++ b/grammars/json_arr.gbnf
@@ -24,7 +24,7 @@ array ::=
string ::=
"\"" (
- [^"\\] |
+ [^"\\\n] |
"\\" (["\\/bfnrt] | "u" [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F]) # escapes
)* "\"" ws