From:             hessu at hes dot iki dot fi
Operating system: linux 2.4.20
PHP version:      4CVS-2003-06-23 (stable)
PHP Bug Type:     Reproducible crash
Bug description:  readfile() and fpassthru() die with SEGV on a 64k file

Description:
------------
php-4.3.2 and php4-STABLE-200306231730 on apache-2.0.46, RedHat Linux on
i386, vanilla 2.4.20 kernel, gcc version 3.2 20020903 (Red Hat Linux 8.0
3.2-7).

When trying to send a binary or ascii file of exactly 65536 bytes using
readfile() or fpassthru(), the httpd process dies with a SIGSEGV. If the
file is 65535 or 65537 bytes long, it is sent out just fine. 32768 and
131072 bytes do not seem to crash, either.

The same source file does not crash the command line version of php.


Reproduce code:
---------------
$ cat 64kcrash.php
<? readfile("64k-of-data"); ?>
$
$ dd if=/dev/urandom of=64k-of-data bs=1 count=65536
OR
$ perl -e 'print "a" × 65536;' > 64k-of-data


Expected result:
----------------
The contents of the file should be sent.

Actual result:
--------------
[Mon Jun 23 22:46:56 2003] [notice] child pid 7805 exit signal
Segmentation fault (11)

client gets EOF after sending the request.

-- 
Edit bug report at http://bugs.php.net/?id=24301&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=24301&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=24301&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=24301&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=24301&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=24301&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=24301&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=24301&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=24301&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=24301&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=24301&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24301&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=24301&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=24301&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=24301&r=gnused

Reply via email to