diff --git a/src/jv_parse.c b/src/jv_parse.c index 519c2047f2..74ea7530a9 100644 --- a/src/jv_parse.c +++ b/src/jv_parse.c @@ -514,6 +514,8 @@ static pfunc check_literal(struct jv_parser* p) { case 'f': pattern = "false"; plen = 5; v = jv_false(); break; case '\'': return "Invalid string literal; expected \", but got '"; + case 0x1e: + return "Record Separator (RS) detected, this might be application/json-seq. Try using the --seq option."; case 'n': // if it starts with 'n', it could be a literal "nan" if (p->tokenbuf[1] == 'u') { diff --git a/tests/jq.test b/tests/jq.test index 404994e268..6f2a88a395 100644 --- a/tests/jq.test +++ b/tests/jq.test @@ -2191,6 +2191,10 @@ try fromjson catch . "{'a': 123}" "Invalid string literal; expected \", but got ' at line 1, column 5 (while parsing '{'a': 123}')" +try fromjson catch . +"\u001e{\"a\": 123}" +"Record Separator (RS) detected, this might be application/json-seq. Try using the --seq option. at line 1, column 2 (while parsing '\u001e{\"a\": 123}')" + # ltrimstr/1 rtrimstr/1 don't leak on invalid input #2977 try ltrimstr(1) catch "x", try rtrimstr(1) catch "x" | "ok"