Bug #74267 [NEW]: segfault with streams and invalid data
| From: | lindsay at notion dot ai | Date: | Fri, 17 Mar 2017 20:27:54 +0000 |
| Subject: | Bug #74267 [NEW]: segfault with streams and invalid data | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-207911@lists.php.net to get a copy of this message | ||
From: lindsay at notion dot ai
Operating system: linux
PHP version: 7.1.3
Package: Streams related
Bug Type: Bug
Bug description:segfault with streams and invalid data
Description:
------------
The scenario to recreate the segfault:
- use stream_filter_append to convert data on fwrite
- try to write data which fails the convert process
- blindly catch and ignore the failed fwrites
- segfault happens on fclose
Tested on 7.1.3, 7.0.13 and 5.6.28
Test script:
---------------
$fh = fopen('/tmp/segfault.txt', 'w');
stream_filter_append( $fh, 'convert.quoted-printable-decode',
STREAM_FILTER_WRITE, array( 'line-break-chars' => "\r\n" ));
$lines = [
"\r\n",
" -=()\r\n",
" -=\r\n",
"\r\n"
];
foreach ($lines as $line)
{
try
{
fwrite($fh, $line);
}
catch (\Exception $e) { }
}
fclose($fh);
--
Edit bug report at https://bugs.php.net/bug.php?id=74267&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74267&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74267&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74267&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=74267&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=74267&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=74267&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=74267&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=74267&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=74267&r=support
Expected behavior: https://bugs.php.net/fix.php?id=74267&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=74267&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=74267&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=74267&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74267&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=74267&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=74267&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=74267&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=74267&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=74267&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=74267&r=mysqlcfg