php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48508 Segfault with "include 'file.phar.bz2'
Submitted: 2009-06-09 14:22 UTC Modified: 2009-06-30 01:00 UTC
From: webmaster at ajeux dot com Assigned: cellog (profile)
Status: No Feedback Package: PHAR related
PHP Version: 5.3CVS-2009-06-09 (snap) OS: Linux 2.6.28
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2009-06-09 14:22 UTC] webmaster at ajeux dot com
Description:
------------
Trying to include a specific .phar leads to a segfault under Linux.

The .phar is a bz2 archive, and very small (just one file inside).
Source of the file can be found here : 
http://uploadfile.org/download.php?id=EqxNUSSdIgcpKKCgrkgG

Bug seems to happen with any .phar.bz2 file.

Reproduce code:
---------------
<?php

include 'cli.phar.bz2';


Expected result:
----------------
working :)

Actual result:
--------------
Segmentation fault

(gdb) run test.php
Starting program: /usr/bin/php53 test.php
[Thread debugging using libthread_db enabled]
[New Thread 0xb7bd88c0 (LWP 14183)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb7bd88c0 (LWP 14183)]
lex_scan (zendlval=0xbfadd56c) at Zend/zend_language_scanner.c:919
919                     if (yych != '<') goto yy4;
(gdb) bt
#0  lex_scan (zendlval=0xbfadd56c) at Zend/zend_language_scanner.c:919
#1  0x08299954 in zendlex (zendlval=0xbfadd568) at /usr/src/olivier/php5.3-200906091030/Zend/zend_compile.c:4880
#2  0x08280c79 in zendparse () at /usr/src/olivier/php5.3-200906091030/Zend/zend_language_parser.c:3280
#3  0x08286139 in compile_file (file_handle=0xbfadd77c, type=2) at Zend/zend_language_scanner.l:343
#4  0x08181f75 in phar_compile_file (file_handle=0xbfadd77c, type=2) at /usr/src/olivier/php5.3-200906091030/ext/phar/phar.c:3360
#5  0x08285c41 in compile_filename (type=2, filename=0xb7ba47dc) at Zend/zend_language_scanner.l:386
#6  0x082f1e94 in ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER (execute_data=0xb7453028) at /usr/src/olivier/php5.3-200906091030/Zend/zend_vm_execute.h:1914
#7  0x082daad2 in execute (op_array=0xb7ba44d0) at /usr/src/olivier/php5.3-200906091030/Zend/zend_vm_execute.h:104
#8  0x082b4bcd in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /usr/src/olivier/php5.3-200906091030/Zend/zend.c:1188
#9  0x0825c4c9 in php_execute_script (primary_file=0xbfadfc68) at /usr/src/olivier/php5.3-200906091030/main/main.c:2196
#10 0x08342101 in main (argc=2, argv=0xbfadfdc4) at /usr/src/olivier/php5.3-200906091030/sapi/cli/php_cli.c:1188


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-06-18 17:55 UTC] cellog@php.net
thanks for the heads up, I'll take a look
 [2009-06-18 18:08 UTC] cellog@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.

I can't reproduce this, and the download link has expired.

Can you also please say from which directory you are running the script?
 [2009-06-18 18:54 UTC] webmaster at ajeux dot com
File can be found here : http://www.ajeux.fr/cli.bz2
It contains a single file cli.php

Download this file and launch this:
<?php
include 'cli.bz2';
?>

Now that I'm more familiar with Phar, I'm not sure this is phar related. I'm just including something that is absolutely not a php readable file, don't I ?

Same SEGFAULT (ie same line/file) when including a bz2 archive that contains a file containing the string 'iiiaaaoouu'; (yes, this is not a php syntax, I can see that ;)   ).

What do you think ?
 [2009-06-22 13:50 UTC] cellog@php.net
two problems:

1) this file is not bzipped, in fact it is not compressed at all
2) this file is not a phar archive, it is a plain tar archive

and the segfault can't be reproduced even when I bzip the resulting archive, so I suspect your system is borked.

If you want to provide a bzipped phar archive that actually reproduces the segfault, that would be fine.

Better yet, please provide a script similar to the following:

<?php
$a = new Phar('cli.phar.bz2');
$a->setStub(file_get_contents('cli.php'));
$a->compress(PHAR::BZ2);
?>

that creates an actual phar archive that is broken.
 [2009-06-30 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Mon Mar 30 23:01:24 2020 UTC