summaryrefslogtreecommitdiffstats
path: root/jv_parse.c
diff options
context:
space:
mode:
authorNicolas Williams <nico@cryptonector.com>2014-12-12 16:58:23 -0600
committerNicolas Williams <nico@cryptonector.com>2014-12-12 17:05:16 -0600
commit2075bec60fd57169b7bf6a440bcf05fbf290ffe9 (patch)
treee6f56099feddbfe40f4a0c09d38eadaa4cf47f6d /jv_parse.c
parent44c23824021821ef7083e786575a13bb292768bf (diff)
Fix #647, but caused by 89791a0
Diffstat (limited to 'jv_parse.c')
-rw-r--r--jv_parse.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/jv_parse.c b/jv_parse.c
index e534e93b..ae2ef7ff 100644
--- a/jv_parse.c
+++ b/jv_parse.c
@@ -456,9 +456,15 @@ jv jv_parser_next(struct jv_parser* p) {
} else if (msg) {
parser_reset(p);
if (ch != '\036' && (p->flags & JV_PARSE_SEQ)) {
+ // Skip to the next RS
p->st = JV_PARSER_WAITING_FOR_RS;
return jv_invalid_with_msg(jv_string_fmt("%s at line %d, column %d (need RS to resync)", msg, p->line, p->column));
}
+ if (!(p->flags & JV_PARSE_SEQ)) {
+ // We're not parsing a JSON text sequence; throw this buffer away.
+ p->curr_buf = 0;
+ p->curr_buf_pos = 0;
+ } // Else ch must be RS; don't clear buf so we can start parsing again after this ch
return jv_invalid_with_msg(jv_string_fmt("%s at line %d, column %d", msg, p->line, p->column));
} else if (p->curr_buf_is_partial) {
assert(p->curr_buf_pos == p->curr_buf_length);