Bug #50207 [Csd]: segmentation fault when concatenating very large strings on 64bit linux
Edit report at https://bugs.php.net/bug.php?id=50207&edit=1
ID: 50207
Updated by: yohgaki@php.net
Reported by: matt at bitwarehouse dot com
Summary: segmentation fault when concatenating very large
strings on 64bit linux
Status: Closed
Type: Bug
Package: Scripting Engine problem
Operating System: CentOS 5 x64
PHP Version: 5.*, 6
-Assigned To:
+Assigned To: yohgaki
Block user comment: N
Private report: N
New Comment:
@mmmshuddup
You should open new bug report for this with script causes crash. Thank you.
Previous Comments:
------------------------------------------------------------------------
[2015-03-09 06:10:08] mmmshuddup at live dot com
Note that this has occurred on various different *nix systems, most notably CentOS 7. Using either
PHP 5.5.20 or 5.6.6.
That leads me to believe that this is probably an inherent bug that never got resolved because it
probably never got noticed. Sorry for the lack of more information on the seg fault, I am not an
actual C dev for PHP and I didn't pull enough info off the server.
Hope this helps, best of luck!
------------------------------------------------------------------------
[2015-03-09 06:05:09] mmmshuddup at live dot com
I have experienced something similar.
$words = explode(' ', $text);
if (count($words) > $count) {
$text = (string) join(' ', array_slice($words, 0, $count));
if ($ellipses) {
$text = trim($text) . '...';
}
}
Segmentation fault occurs when base64 encoded images are in the string! (e.g. <img
src="data:image/png;base64,iVBORw0KGgoA...." />)
Now, in this case I don't think it's the length of the string itself that is the problem,
but rather the the length of that "word," which in the case of a larger image, is a very
very long string of characters with no whitespace separation.
------------------------------------------------------------------------
[2009-11-19 14:04:43] iliaa@php.net
This bug has been fixed in SVN.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
------------------------------------------------------------------------
[2009-11-19 14:04:35] svn@php.net
Automatic comment from SVN on behalf of iliaa
Revision: http://svn.php.net/viewvc/?view=revision&revision=290995
Log: Fixed bug #50207 (segmentation fault when concatenating very large strings
on 64bit linux).
------------------------------------------------------------------------
[2009-11-17 18:36:43] matt at bitwarehouse dot com
Clarification. The reproduce code should be:
<?php
// run me with: php -d memory_limit=-1
$s = str_repeat('A', pow(2,31));
$s .= 'B'; // fails with segfault
printf("strlen: %u last-char: %c", strlen($s), $s[pow(2,31)]);
?>
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=50207
--
Edit this bug report at https://bugs.php.net/bug.php?id=50207&edit=1
Thread (7 messages)