mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
codegen.c: no OP_HASHADD required when val is false.
Address CVE-2022-0326
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user