Bug #78762 [Asn->Csd]: Failing FFI::cast() may leak memory
| From: | cmb@php.net | Date: | Wed, 30 Oct 2019 16:23:26 +0000 |
| Subject: | Bug #78762 [Asn->Csd]: Failing FFI::cast() may leak memory | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-223520@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=78762&edit=1
ID: 78762
Updated by: cmb@php.net
Reported by: cmb@php.net
Summary: Failing FFI::cast() may leak memory
-Status: Assigned
+Status: Closed
Type: Bug
Package: *Extensibility Functions
Operating System: *
PHP Version: 7.4Git-2019-10-30 (Git)
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=1e2d3d58a8b392385d926bdca11ba0a0bc2547b4
Log: Fix #78762: Failing FFI::cast() may leak memory
Previous Comments:
------------------------------------------------------------------------
[2019-10-30 16:13:00] cmb@php.net
Description:
------------
If FFI::cast() fails with FFI\Exception "attempt to cast to larger
type", a zend_ffi_cdata struct is leaked.
Test script:
---------------
<?php
try {
FFI::cast('char[10]', FFI::new('char[1]'));
} catch (FFI\Exception $ex) {
echo $ex->getMessage(), PHP_EOL;
}
Expected result:
----------------
attempt to cast to larger type
Actual result:
--------------
attempt to cast to larger type
[Wed Oct 30 17:10:23 2019] Script: '/mnt/d/git/php/bug78761.php'
/mnt/d/git/php/php-src/ext/ffi/ffi.c(241) : Freeing 0x00007f0f67081180 (88 bytes),
script=/mnt/d/git/php/bug78761.php
=== Total 1 memory leaks detected ===
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=78762&edit=1