Skip to the next RS after a parse error in --seq mode (#3654)
In --seq mode, a parse error was reported as "need RS to resync", but parsing continued in the middle of the broken text, so fragments of it were reported as more errors or output as values. Set the parser state to wait for the next RS after resetting the parser, instead of before, so that the rest of the broken text is skipped as RFC 7464 recommends.
This commit is contained in:
1 parent
611c575a97
commit
80fc7a169d
2 files changed
+9
-1
No files matched your search
+1
-1
@@ -785,9 +785,9 @@ jv jv_parser_next(struct jv_parser* p) {
|
||||
jv_free(value);
|
||||
if (ch != '\036' && (p->flags & JV_PARSE_SEQ)) {
|
||||
// Skip to the next RS
|
||||
p->st = JV_PARSER_WAITING_FOR_RS;
|
||||
value = make_error(p, "%s at line %d, column %d (need RS to resync)", msg, p->line, p->column);
|
||||
parser_reset(p);
|
||||
p->st = JV_PARSER_WAITING_FOR_RS;
|
||||
return value;
|
||||
}
|
||||
value = make_error(p, "%s at line %d, column %d", msg, p->line, p->column);
|
||||
|
||||
Reference in new issue
Block a user