Fix GH-16397: Segmentation fault when comparing FFI object#16401
Merged
ndossche merged 1 commit intophp:PHP-8.2from Oct 14, 2024
Merged
Fix GH-16397: Segmentation fault when comparing FFI object#16401ndossche merged 1 commit intophp:PHP-8.2from
ndossche merged 1 commit intophp:PHP-8.2from
Conversation
cmb69
approved these changes
Oct 12, 2024
ext/ffi/tests/gh16397.phpt
Outdated
| $ffi = FFI::cdef(); | ||
| try { | ||
| var_dump($ffi != 1); | ||
| } catch (Error $e) { |
Member
There was a problem hiding this comment.
Could be more specific by catching only FFI\Exception.
Girgias
reviewed
Oct 13, 2024
dstogov
approved these changes
Oct 14, 2024
ext/ffi/ffi.c
Outdated
| } | ||
| /* }}} */ | ||
|
|
||
| static int zend_ffi_compare_objects(zval *o1, zval *o2) |
Member
There was a problem hiding this comment.
I would name this zend _fake_compare_objects for consistency.
ndossche
added a commit
to ndossche/php-src
that referenced
this pull request
Oct 14, 2024
`compare` is a required handler [1], but this handler was set to NULL. Throw an exception when trying to compare FFI objects. [1] https://github.com/php/php-src/blob/35c8a010c6633a2a1ba7c16a0cf83affa07b819e/Zend/zend_object_handlers.h#L231C1-L231C64 Closes phpGH-16401.
eb81841 to
ef6c84e
Compare
`compare` is a required handler [1], but this handler was set to NULL. Throw an exception when trying to compare FFI objects. [1] https://github.com/php/php-src/blob/35c8a010c6633a2a1ba7c16a0cf83affa07b819e/Zend/zend_object_handlers.h#L231C1-L231C64 Closes phpGH-16401.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
compareis a required handler [1], but this handler was set to NULL. Throw an exception when trying to compare FFI objects.[1] https://github.com/php/php-src/blob/35c8a010c6633a2a1ba7c16a0cf83affa07b819e/Zend/zend_object_handlers.h#L231C1-L231C64