Bug #68996 [NEW]: Invalid free of CG(interned_empty_string)
From: manuel-php at mausz dot at Date: Fri, 06 Feb 2015 15:58:19 +0000 Subject: Bug #68996 [NEW]: Invalid free of CG(interned_empty_string) Groups: php.bugs Request: Send a blank email to php-bugs+get-190489@lists.php.net to get a copy of this message
From: manuel-php at mausz dot at
Operating system:
PHP version: 5.6.6RC1
Package: Reproducible crash
Bug Type: Bug
Bug description:Invalid free of CG(interned_empty_string)
Description:
------------
If php_escape_html_entities fails CG(interned_empty_string) will be
freed:
* If interned strings are enabled (default) STR_EMPTY_ALLOC is an alias
for CG(interned_empty_string)
see https://github.com/php/php-src/blob/PHP-5.6/Zend/zend.h#L682
* php_escape_html_entities_ex returns STR_EMPTY_ALLOC in case of
failure
see
https://github.com/php/php-src/blob/PHP-5.6/ext/standard/html.c#L1307
* php_escape_html_entities is used in php_verror if display_errors is
enabled
see https://github.com/php/php-src/blob/PHP-5.6/main/main.c#L848
* Thus CG(interned_empty_string) gets freed
see https://github.com/php/php-src/blob/PHP-5.6/main/main.c#L921
This issue is even worse when opcache is enabled.
Sample script:
fopen("\xfc\x63", "r");
https://github.com/php/php-src/blob/PHP-5.6/ext/wddx/wddx.c#L408:
wddx_serialize_value("\xfc\x63");
https://github.com/php/php-src/blob/PHP-5.6/ext/wddx/wddx.c#L633:
wddx_serialize_value([ "\xfc\x63" => "foo" ]);
https://github.com/php/php-src/blob/PHP-5.6/ext/soap/soap.c#L3997
https://github.com/php/php-src/blob/PHP-5.6/ext/soap/soap.c#L4022
(new SoapServer(NULL, [ "location" => "http://foo", "uri" =>
"http://foo" ]))->fault("\xfc\x63",
"foo");
No issues (imho):
https://github.com/php/php-src/blob/PHP-5.6/main/main.c#L790
https://github.com/php/php-src/blob/PHP-5.6/sapi/fpm/fpm/fpm_status.c#L421
https://github.com/php/php-src/blob/PHP-5.6/sapi/cli/php_cli_server.c#L1929
php_escape_html_entities calls in
https://github.com/php/php-src/blob/PHP-5.6/info/info.c
are safe too
--
Edit bug report at https://bugs.php.net/bug.php?id=68996&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=68996&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=68996&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=68996&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=68996&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=68996&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=68996&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=68996&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=68996&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=68996&r=support
Expected behavior: https://bugs.php.net/fix.php?id=68996&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=68996&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=68996&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=68996&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=68996&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=68996&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=68996&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=68996&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=68996&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=68996&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=68996&r=mysqlcfg
Thread (5 messages)
| « previous | php.bugs (#190489) | next » |
|---|