File tree Expand file tree Collapse file tree 3 files changed +16
-0
lines changed Expand file tree Collapse file tree 3 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ PHP NEWS
18
18
- FFI:
19
19
. Fixed bug #78716 (Function name mangling is wrong for some parameter
20
20
types). (cmb)
21
+ . Fixed bug #78762 (Failing FFI::cast() may leak memory). (cmb)
21
22
. Implement FR #78270 (Support __vectorcall convention with FFI). (cmb)
22
23
23
24
- FPM:
Original file line number Diff line number Diff line change @@ -3882,6 +3882,7 @@ ZEND_METHOD(FFI, cast) /* {{{ */
3882
3882
cdata -> ptr = & cdata -> ptr_holder ;
3883
3883
cdata -> ptr_holder = old_cdata -> ptr ;
3884
3884
} else if (type -> size > old_type -> size ) {
3885
+ zend_object_release (& cdata -> std );
3885
3886
zend_throw_error (zend_ffi_exception_ce , "attempt to cast to larger type" );
3886
3887
return ;
3887
3888
} else if (ptr != & old_cdata -> ptr_holder ) {
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #78762 (Failing FFI::cast() may leak memory)
3
+ --SKIPIF--
4
+ <?php require_once ('skipif.inc ' ); ?>
5
+ --FILE--
6
+ <?php
7
+ try {
8
+ FFI ::cast ('char[10] ' , FFI ::new ('char[1] ' ));
9
+ } catch (FFI \Exception $ ex ) {
10
+ echo $ ex ->getMessage (), PHP_EOL ;
11
+ }
12
+ ?>
13
+ --EXPECT--
14
+ attempt to cast to larger type
You can’t perform that action at this time.
0 commit comments