|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
  [2004-01-08 13:16 UTC] djones at xtreme-eda dot com
 Description: ------------ PHP configuration: http://www.inode.org/test.php I am running an application that sends files to the user using fpassthru(). With certain files, Apache exits with signal 11. There does not seem to be any distinguishing characteristic between files that are sent OK and files that are not. Reproduce code: --------------- See http://www.inode.org/passthru.php_ The trailing underscore prevents execution so you can view the source. The code contains paths to two files; one of which can be transferred and one that cannot. You may transfer these files to your system to attempt reproduction. (Instructions for said transfer are provided in passthru.php) Running the BAD file from the PHP command line appears to work correctly so this might be a PHP-Apache interaction issue. Expected result: ---------------- With the GOOD file: you can save the document and view it. With the BAD file: I would expect to be able to save it too. Actual result: -------------- With the BAD file: Apache segfaults signal 11. I'm not sure how I can get a GDB backtrace from a running Apache instance. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             | |||||||||||||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 01:00:01 2025 UTC | 
I believe the problem to be at line 84 in sapi_apache2.c: copy_str = apr_pmemdup( r->pool, str, str_length+1); This function appears to copy one more byte than required. It is not clear to me why this is required, as the length is passed explicitly (and we ought to be able to pass null-terminated data, e.g. Word documents!) The problem: if the source is mmap()ped and the file in question is exactly a multiple of the page size, then the extra byte refers to a page just beyond the mapping. When this final byte is accessed you get a segmentation fault. I have verified that the segfault occurs in FreeBSD's memcpy() at a point where the address is at the end of the mapping and the remaining byte count is 1.