From b1a4e994fde929300d4aeb1deb8320c59cb6edec Mon Sep 17 00:00:00 2001 From: ExtReMLapin <3909752+ExtReMLapin@users.noreply.github.com> Date: Tue, 5 Mar 2024 14:44:29 +0100 Subject: [PATCH] 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 --- grammars/json.gbnf | 2 +- grammars/json_arr.gbnf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/grammars/json.gbnf b/grammars/json.gbnf index a9537cdf9..34e014d55 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 ef53e77a0..fd5740eeb 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