jv_setpath()+setpath/2: don't leak the input after an invalid get
Ref: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=64906
This commit is contained in:
1 parent
80bc768c5d
commit
6b69ffe769
2 files changed
+5
No files matched your search
@@ -408,6 +408,7 @@ jv jv_setpath(jv root, jv path, jv value) {
|
|||||||
|
|
||||||
jv subroot = jv_get(jv_copy(root), jv_copy(pathcurr));
|
jv subroot = jv_get(jv_copy(root), jv_copy(pathcurr));
|
||||||
if (!jv_is_valid(subroot)) {
|
if (!jv_is_valid(subroot)) {
|
||||||
|
jv_free(root);
|
||||||
jv_free(pathcurr);
|
jv_free(pathcurr);
|
||||||
jv_free(pathrest);
|
jv_free(pathrest);
|
||||||
jv_free(value);
|
jv_free(value);
|
||||||
|
|||||||
@@ -2091,3 +2091,7 @@ try ("foobar" | .[1.5]) catch .
|
|||||||
null
|
null
|
||||||
"Cannot index string with number"
|
"Cannot index string with number"
|
||||||
|
|
||||||
|
# setpath/2 does not leak the input after an invalid get #2967
|
||||||
|
try ["ok", setpath([1]; 1)] catch ["ko", .]
|
||||||
|
{"hi":"hello"}
|
||||||
|
["ko","Cannot index object with number"]
|
||||||
Reference in new issue
Block a user