Bug #78762 [NEW]: Failing FFI::cast() may leak memory

From: Date: Wed, 30 Oct 2019 16:13:00 +0000
Subject: Bug #78762 [NEW]: Failing FFI::cast() may leak memory
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-223519@lists.php.net to get a copy of this message
From: cmb Operating system: * PHP version: 7.4Git-2019-10-30 (Git) Package: *Extensibility Functions Bug Type: Bug Bug description:Failing FFI::cast() may leak memory 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 bug report at https://bugs.php.net/bug.php?id=78762&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=78762&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=78762&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=78762&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=78762&r=needscript Try newer version: https://bugs.php.net/fix.php?id=78762&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=78762&r=support Expected behavior: https://bugs.php.net/fix.php?id=78762&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=78762&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=78762&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=78762&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=78762&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=78762&r=dst IIS Stability: https://bugs.php.net/fix.php?id=78762&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=78762&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=78762&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=78762&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=78762&r=mysqlcfg

« previous php.bugs (#223519) next »