Skip to content
Myr

Setup path correctly after stream parsing a key:value object pair (#2642)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Mattias Wadman · committed by GitHub · parent 7d424fd · Browse files · 2 files+5 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+5 added−1 removed

  • tests:+4 added−0 removed
  • other:+1 added−1 removed

2 files+5 added−1 removed

modified:src/jv_parse.c+1 added-1 removed
297 unmodified lines
298 if (jv_is_valid(p->next)) {299 p->output = JV_ARRAY(jv_copy(p->path), p->next);300 p->next = jv_invalid();301 }302 p->path = jv_array_set(p->path, p->stacklen - 1, jv_true()); // ready for another name:value pair302 p->path = jv_array_set(p->path, p->stacklen - 1, jv_null()); // ready for another key:value pair303 p->last_seen = JV_LAST_COMMA;304 } else {305 assert(k == JV_KIND_NULL);306 // this case hits on input like {,}
570 unmodified lines
modified:tests/shtest+4 added
201 unmodified lines
202else203 echo "Not doing torture tests"204fi205206## Regression test for issue #2378 assert when stream parse broken object pair207echo '{"a":1,"b",' | $JQ --stream > /dev/null 2> $d/err208grep 'Objects must consist of key:value pairs' $d/err > /dev/null209210## Fuzz parser211212## XXX With a $(urandom) builtin we could move this test into tests/all.test213clean=false
140 unmodified lines