Skip to content
Myr

jv_setpath()+setpath/2: don't leak the input after an invalid get

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

authored by Emanuele Torre · committed by GitHub · parent 80bc768 · Browse files · 2 files+5 added−0 removed
This commit

State

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

Trailers

  • Ref: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=64906

Diff stats

2 files+5 added−0 removed

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

2 files+5 added−0 removed

modified:src/jv_aux.c+1 added
406 unmodified lines
407 }408409 jv subroot = jv_get(jv_copy(root), jv_copy(pathcurr));410 if (!jv_is_valid(subroot)) {411 jv_free(root);412 jv_free(pathcurr);413 jv_free(pathrest);414 jv_free(value);415 return subroot;
315 unmodified lines
modified:tests/jq.test+4 added
2089 unmodified lines
2090try ("foobar" | .[1.5]) catch .2091null2092"Cannot index string with number"20932094# setpath/2 does not leak the input after an invalid get #29672095try ["ok", setpath([1]; 1)] catch ["ko", .]2096{"hi":"hello"}2097["ko","Cannot index object with number"]