Skip to content

Commit d1fceee

Browse files
committed
Check stack limit in fuzzer executor
The stack limit is checked when entering execute_ex(), but the fuzzer has its own execute function and does not call execute_ex(). Add a stack limit check in the fuzzer's execute function. Closes GH-19391
1 parent c42e6d6 commit d1fceee

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

sapi/fuzzer/fuzzer-execute-common.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,18 @@ static zend_always_inline void fuzzer_step(void) {
5353
static void (*orig_execute_ex)(zend_execute_data *execute_data);
5454

5555
static void fuzzer_execute_ex(zend_execute_data *execute_data) {
56+
57+
#ifdef ZEND_CHECK_STACK_LIMIT
58+
if (UNEXPECTED(zend_call_stack_overflowed(EG(stack_limit)))) {
59+
zend_call_stack_size_error();
60+
/* No opline was executed before exception */
61+
EG(opline_before_exception) = NULL;
62+
/* Fall through to handle exception below. */
63+
}
64+
#endif /* ZEND_CHECK_STACK_LIMIT */
65+
5666
const zend_op *opline = EX(opline);
67+
5768
while (1) {
5869
fuzzer_step();
5970
opline = ((opcode_handler_t) opline->handler)(execute_data, opline);

0 commit comments

Comments
 (0)