php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63874 Segfault if php_strip_whitespace has heredoc
Submitted: 2012-12-29 22:32 UTC Modified: 2012-12-30 10:49 UTC
From: igor at wiedler dot ch Assigned:
Status: Closed Package: Unknown/Other Function
PHP Version: 5.5Git-2012-12-29 (Git) OS: OSX 10.8.2
Private report: No CVE-ID:
 [2012-12-29 22:32 UTC] igor at wiedler dot ch
Description:
------------
When a filename that contains a heredoc is passed to php_strip_whitespace, it 
results in a segmentation fault / buffer overflow.

Here is the output from --enable-debug:

[Sat Dec 29 22:22:09 2012]  Script:  '/Users/igor/test.php'
---------------------------------------
/Users/igor/src/php-src/Zend/zend_highlight.c(189) : Block 0x1036a66d8 status:
Beginning:  	Cached
Freed (invalid)
    Start:	OK
      End:	OK
---------------------------------------

Test script:
---------------
<?php

$contents = php_strip_whitespace(__FILE__);

return <<<A
a
A;



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-12-30 04:17 UTC] pierrick@php.net
-Summary: Buffer overflow if php_strip_whitespace has heredoc +Summary: Segfault if php_strip_whitespace has heredoc
 [2012-12-30 04:17 UTC] pierrick@php.net
Automatic comment on behalf of pierrick
Revision: http://git.php.net/?p=php-src.git;a=commit;h=8228597ecce3ad868d2c6bfca5ff43f29e014296
Log: Fixed bug #63874 (Segfaul if php_strip_whitespace has heredoc)
 [2012-12-30 04:17 UTC] pierrick@php.net
-Status: Open +Status: Closed
 [2012-12-30 10:49 UTC] igor at wiedler dot ch
Fix confirmed. Thanks!
 [2013-01-12 16:39 UTC] derick@php.net
Automatic comment on behalf of pierrick
Revision: http://git.php.net/?p=php-src.git;a=commit;h=8228597ecce3ad868d2c6bfca5ff43f29e014296
Log: Fixed bug #63874 (Segfaul if php_strip_whitespace has heredoc)
 [2013-11-17 09:32 UTC] laruence@php.net
Automatic comment on behalf of pierrick
Revision: http://git.php.net/?p=php-src.git;a=commit;h=8228597ecce3ad868d2c6bfca5ff43f29e014296
Log: Fixed bug #63874 (Segfaul if php_strip_whitespace has heredoc)
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Thu Apr 17 06:02:13 2014 UTC