Skip to content

Fix OSS-Fuzz #546798343: Heap-buffer-overflow in zend_delete_call_ins… - #23777

Closed
ndossche wants to merge 1 commit into
php:PHP-8.4from
ndossche:oss-fuzz-delete-call-kapot
Closed

ndossche wants to merge 1 commit into
php:PHP-8.4from
ndossche:oss-fuzz-delete-call-kapot

Conversation

@ndossche

Copy link
Copy Markdown
Member

…tructions with callable conversion

Call level counter was broken: ZEND_CALLABLE_CONVERT was forgotten.

Note for master: needs ZEND_CALLABLE_CONVERT_PARTIAL too!

…tructions with callable conversion

Call level counter was broken: ZEND_CALLABLE_CONVERT was forgotten.

@LamentXU123 LamentXU123 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 line of php to cause memory bugs. New record.
This looks good as I tried to make sense of the code here as a newcomer to opcache.

--TEST--
OSS-Fuzz #546798343 (Heap-buffer-overflow in zend_delete_call_instructions with callable conversion)
--EXTENSIONS--
opcache

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

without the opcache.enable_cli it runs only on CI right ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I'll add the opcache INIs

case ZEND_DO_ICALL:
case ZEND_DO_UCALL:
case ZEND_DO_FCALL_BY_NAME:
case ZEND_CALLABLE_CONVERT:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

outside of this PR perview of course, but is it me or is it missing in zend opcode too (and _PARTIAL as well) ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't understand what you meant with "missing in zend opcode"?
Also yes, on master this also needs ZEND_CALLABLE_CONVERT_PARTIAL, but that opcode only exists on master

@devnexen devnexen Sep 19, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah yes I did not realise it was 8.4 .. so I meant Zend/zend_opcode.c line ~829 (master). But again, maybe I misread.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks like the handling for the NEW opcode, but you can't make an FCC callable (or PFA) for the new invocation. I.e. this is not possible: $closure = new Foo(...);.
So that code should be fine.

@ndossche ndossche closed this in 3213c3f Sep 19, 2026
@ndossche

Copy link
Copy Markdown
Member Author

Done the INI in the merge, and done the PFA fix in master during merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants