We have to reset `FFI_G(persistent)` back to zero when preloading has
finished.
. Fixed bug #78716 (Function name mangling is wrong for some parameter
types). (cmb)
. Fixed bug #78762 (Failing FFI::cast() may leak memory). (cmb)
+ . Fixed bug #78761 (Zend memory heap corruption with preload and casting).
+ (cmb)
. Implement FR #78270 (Support __vectorcall convention with FFI). (cmb)
- FPM:
efree(code);
FFI_G(symbols) = NULL;
FFI_G(tags) = NULL;
+ FFI_G(persistent) = 0;
return ffi;
--- /dev/null
+--TEST--
+Bug #78761 (Zend memory heap corruption with preload and casting)
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--INI--
+opcache.enable_cli=1
+opcache.preload={PWD}/bug78761_preload.php
+--FILE--
+<?php
+try {
+ FFI::cast('char[10]', FFI::new('char[1]'));
+} catch (FFI\Exception $ex) {
+ echo $ex->getMessage(), PHP_EOL;
+}
+?>
+--EXPECT--
+attempt to cast to larger type
--- /dev/null
+<?php
+
+FFI::load(__DIR__ . '/bug78761_preload.h');