Skip to content

Commit b4285e5

Browse files
committed
Ensure vm_spec_handlers exists for all opcodes <= 255 so that user defined higher opcodes do not read outside buffer
This largely has no effect in practice, but ASAN will complain then.
1 parent 212b31b commit b4285e5

File tree

2 files changed

+56
-2
lines changed

2 files changed

+56
-2
lines changed

Zend/zend_vm_execute.h

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63870,7 +63870,59 @@ void zend_vm_init(void)
6387063870
2542,
6387163871
2543,
6387263872
2544,
63873-
3448
63873+
3448,
63874+
3448,
63875+
3448,
63876+
3448,
63877+
3448,
63878+
3448,
63879+
3448,
63880+
3448,
63881+
3448,
63882+
3448,
63883+
3448,
63884+
3448,
63885+
3448,
63886+
3448,
63887+
3448,
63888+
3448,
63889+
3448,
63890+
3448,
63891+
3448,
63892+
3448,
63893+
3448,
63894+
3448,
63895+
3448,
63896+
3448,
63897+
3448,
63898+
3448,
63899+
3448,
63900+
3448,
63901+
3448,
63902+
3448,
63903+
3448,
63904+
3448,
63905+
3448,
63906+
3448,
63907+
3448,
63908+
3448,
63909+
3448,
63910+
3448,
63911+
3448,
63912+
3448,
63913+
3448,
63914+
3448,
63915+
3448,
63916+
3448,
63917+
3448,
63918+
3448,
63919+
3448,
63920+
3448,
63921+
3448,
63922+
3448,
63923+
3448,
63924+
3448,
63925+
3448,
6387463926
};
6387563927
#if (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID)
6387663928
zend_opcode_handler_funcs = labels;

Zend/zend_vm_gen.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1525,7 +1525,9 @@ function gen_specs($f, $prolog, $specs) {
15251525
$last = $num;
15261526
out($f, "$prolog$def,\n");
15271527
}
1528-
out($f, "$prolog$lastdef\n");
1528+
while ($last++ < 255) {
1529+
out($f, "$prolog$lastdef,\n");
1530+
}
15291531
}
15301532

15311533
// Generates handler for undefined opcodes (CALL threading model)

0 commit comments

Comments
 (0)