Bug #77360 [NEW]: class_uses causes segfault
| From: | lauri dot kentta at gmail dot com | Date: | Thu, 27 Dec 2018 14:15:47 +0000 |
| Subject: | Bug #77360 [NEW]: class_uses causes segfault | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-218643@lists.php.net to get a copy of this message | ||
From: lauri dot kentta at gmail dot com
Operating system: Linux
PHP version: 7.3.0
Package: SPL related
Bug Type: Bug
Bug description:class_uses causes segfault
Description:
------------
Similar to bug #77359, the function spl_find_ce_by_name has
use-after-free of a zend_string and causes segfault. This affects
functions class_parents, class_implements and class_uses. This bug is
caused by commit 084c17fe0b68d391467fd48a14433443d4fcba81.
Test script:
---------------
<?php
$a = md5(""); # Create a non-interned string.
@class_uses($a, false); # Invalid free.
@class_uses($a, false); # Use after free.
echo "{$a} + foo\n"; # Use after free.
# Notice how "foo" is not printed even if the code does not crash.
# Run it a few times to get a crash.
?>
Expected result:
----------------
No crash and full output.
Actual result:
--------------
Crash or truncated output.
--
Edit bug report at https://bugs.php.net/bug.php?id=77360&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=77360&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=77360&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=77360&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=77360&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=77360&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=77360&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=77360&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=77360&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=77360&r=support
Expected behavior: https://bugs.php.net/fix.php?id=77360&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=77360&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=77360&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=77360&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77360&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=77360&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=77360&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=77360&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=77360&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=77360&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=77360&r=mysqlcfg