1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Merge branch 'PHP-8.2' into PHP-8.3

* PHP-8.2:
  Fix GH-16397: Segmentation fault when comparing FFI object (#16401)
This commit is contained in:
Niels Dossche
2024-10-14 19:24:01 +02:00
3 changed files with 26 additions and 1 deletions

4
NEWS
View File

@@ -26,6 +26,10 @@ PHP NEWS
. Fixed bug GH-16409 (Segfault in exif_thumbnail when not dealing with a
real file). (nielsdos, cmb)
- FFI:
. Fixed bug GH-16397 (Segmentation fault when comparing FFI object).
(nielsdos)
- GD:
. Fixed bug GH-16334 (imageaffine overflow on matrix elements).
(David Carlier)

View File

@@ -2936,6 +2936,12 @@ static zend_function *zend_ffi_get_func(zend_object **obj, zend_string *name, co
}
/* }}} */
static int zend_fake_compare_objects(zval *o1, zval *o2)
{
zend_throw_error(zend_ffi_exception_ce, "Cannot compare FFI objects");
return ZEND_UNCOMPARABLE;
}
static zend_never_inline int zend_ffi_disabled(void) /* {{{ */
{
zend_throw_error(zend_ffi_exception_ce, "FFI API is restricted by \"ffi.enable\" configuration directive");
@@ -5436,7 +5442,7 @@ ZEND_MINIT_FUNCTION(ffi)
zend_ffi_handlers.has_dimension = zend_fake_has_dimension;
zend_ffi_handlers.unset_dimension = zend_fake_unset_dimension;
zend_ffi_handlers.get_method = zend_ffi_get_func;
zend_ffi_handlers.compare = NULL;
zend_ffi_handlers.compare = zend_fake_compare_objects;
zend_ffi_handlers.cast_object = zend_fake_cast_object;
zend_ffi_handlers.get_debug_info = NULL;
zend_ffi_handlers.get_closure = NULL;

View File

@@ -0,0 +1,15 @@
--TEST--
GH-16397 (Segmentation fault when comparing FFI object)
--EXTENSIONS--
ffi
--FILE--
<?php
$ffi = FFI::cdef();
try {
var_dump($ffi != 1);
} catch (FFI\Exception $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
Cannot compare FFI objects