codegen.c: no OP_HASHADD required when val is false.

Address CVE-2022-0326
This commit is contained in:
Yukihiro "Matz" Matsumoto
2022-01-21 15:42:51 +09:00
parent 15f597e835
commit beef5d37ad
+1 -2
View File
@@ -1644,14 +1644,13 @@ gen_hash(codegen_scope *s, node *tree, int val, int limit)
}
}
if (update) {
if (len > 0) {
if (val && len > 0) {
pop_n(len*2+1);
genop_2(s, OP_HASHADD, cursp(), len);
push();
}
return -1; /* variable length */
}
if (update) return -1;
return len;
}