php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45591 Bus error on file_get_contents
Submitted: 2008-07-22 15:02 UTC Modified: 2008-11-18 18:54 UTC
Votes:4
Avg. Score:4.2 ± 0.8
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:3 (100.0%)
From: rommer at active dot by Assigned:
Status: Closed Package: Reproducible crash
PHP Version: 5.2CVS-2008-07-22 (snap) OS: linux-2.6.x i386
Private report: No CVE-ID: None
 [2008-07-22 15:02 UTC] rommer at active dot by
Description:
------------
"Bus error" calling file_get_contents

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

// file name
$filename = 'test.dat';

// make this file 50000 bytes lenght
$f = fopen($filename, 'w');
ftruncate($f, 50000);
fclose($f);

// read content from 49152 byte, 8192 bytes length
file_get_contents($filename, false, NULL, 49152, 8192);

?>

Expected result:
----------------
nothing

Actual result:
--------------
"Bus error"

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-07-22 22:08 UTC] jani@php.net
I can not reproduce this. How about giving us the basic info:

1. the configure line
2. output of "php -v"
3. output of "php -m"

 [2008-07-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".
 [2008-09-29 15:29 UTC] rlucia at iscanet dot com
# php -v
PHP 5.2.5 (cli) (built: Apr 16 2008 19:24:05) 
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
    with eAccelerator v0.9.5.3, Copyright (c) 2004-2006 eAccelerator, by eAccelerator
# php -m
[PHP Modules]
ctype
curl
date
dom
eAccelerator
ffmpeg
filter
gd
geoip
hash
iconv
json
libxml
magickwand
mcrypt
memcache
mysql
mysqli
openssl
pcre
PDO
pdo_mysql
pdo_sqlite
posix
Reflection
session
SimpleXML
SPL
SQLite
standard
tokenizer
xml
xmlreader
xmlwriter
zlib

[Zend Modules]
eAccelerator






Core was generated by `/usr/local/apache2//bin/httpd -k start'.
Program terminated with signal 7, Bus error.
#0  0xb7d09b35 in memcpy () from /lib/tls/i686/cmov/libc.so.6
(gdb) bt
#0  0xb7d09b35 in memcpy () from /lib/tls/i686/cmov/libc.so.6
#1  0xb7af3f4c in _php_stream_copy_to_mem (src=0xb6ed7db8, buf=0xbff4f9bc, maxlen=4294967295, persistent=0)
    at /usr/local/src/php-5.2.5/main/streams/streams.c:1223
#2  0xb7a83106 in zif_file_get_contents (ht=1, return_value=0xb2372fd4, return_value_ptr=0x0, this_ptr=0x0, 
    return_value_used=1) at /usr/local/src/php-5.2.5/ext/standard/file.c:563
#3  0xb7b3cbb2 in zend_do_fcall_common_helper_SPEC (execute_data=0xbff4fbd0)
    at /usr/local/src/php-5.2.5/Zend/zend_vm_execute.h:200
#4  0xb7b3bbe8 in execute (op_array=0xb23b6330) at /usr/local/src/php-5.2.5/Zend/zend_vm_execute.h:92
#5  0xb7b3c618 in zend_do_fcall_common_helper_SPEC (execute_data=0xbff4fe10)
    at /usr/local/src/php-5.2.5/Zend/zend_vm_execute.h:234
#6  0xb7b3bbe8 in execute (op_array=0xb23b6330) at /usr/local/src/php-5.2.5/Zend/zend_vm_execute.h:92
#7  0xb7b3c618 in zend_do_fcall_common_helper_SPEC (execute_data=0xbff50050)
    at /usr/local/src/php-5.2.5/Zend/zend_vm_execute.h:234
#8  0xb7b3bbe8 in execute (op_array=0xb23b6330) at /usr/local/src/php-5.2.5/Zend/zend_vm_execute.h:92
#9  0xb7b3c618 in zend_do_fcall_common_helper_SPEC (execute_data=0xbff50290)
    at /usr/local/src/php-5.2.5/Zend/zend_vm_execute.h:234
#10 0xb7b3bbe8 in execute (op_array=0xb23b6330) at /usr/local/src/php-5.2.5/Zend/zend_vm_execute.h:92
#11 0xb7b3c618 in zend_do_fcall_common_helper_SPEC (execute_data=0xbff50740)
    at /usr/local/src/php-5.2.5/Zend/zend_vm_execute.h:234
#12 0xb7b3bbe8 in execute (op_array=0xb23b5e9c) at /usr/local/src/php-5.2.5/Zend/zend_vm_execute.h:92
#13 0xb7b3c618 in zend_do_fcall_common_helper_SPEC (execute_data=0xbff50a40)
    at /usr/local/src/php-5.2.5/Zend/zend_vm_execute.h:234
#14 0xb7b3bbe8 in execute (op_array=0xb23af4b8) at /usr/local/src/php-5.2.5/Zend/zend_vm_execute.h:92
#15 0xb7b13df8 in zend_call_function (fci=0xbff50b88, fci_cache=0xbff50bac)
    at /usr/local/src/php-5.2.5/Zend/zend_execute_API.c:990
#16 0xb7a03ca5 in zim_reflection_method_invokeArgs (ht=2, return_value=0xb236d4f8, return_value_ptr=0x0, 
    this_ptr=0xb236cedc, return_value_used=1) at /usr/local/src/php-5.2.5/ext/reflection/php_reflection.c:2479
#17 0xb7b3cbb2 in zend_do_fcall_common_helper_SPEC (execute_data=0xbff50dc0)
    at /usr/local/src/php-5.2.5/Zend/zend_vm_execute.h:200
#18 0xb7b3bbe8 in execute (op_array=0xb23e9094) at /usr/local/src/php-5.2.5/Zend/zend_vm_execute.h:92
#19 0xb7b3c618 in zend_do_fcall_common_helper_SPEC (execute_data=0xbff51080)
    at /usr/local/src/php-5.2.5/Zend/zend_vm_execute.h:234
#20 0xb7b3bbe8 in execute (op_array=0xb23e9160) at /usr/local/src/php-5.2.5/Zend/zend_vm_execute.h:92
#21 0xb7b3c618 in zend_do_fcall_common_helper_SPEC (execute_data=0xbff512d0)
    at /usr/local/src/php-5.2.5/Zend/zend_vm_execute.h:234
#22 0xb7b3bbe8 in execute (op_array=0xb6ed78ac) at /usr/local/src/php-5.2.5/Zend/zend_vm_execute.h:92
#23 0xb7b1e574 in zend_execute_scripts (type=8, retval=<value optimized out>, file_count=3)
    at /usr/local/src/php-5.2.5/Zend/zend.c:1134
#24 0xb7adf3c0 in php_execute_script (primary_file=0xbff53578) at /usr/local/src/php-5.2.5/main/main.c:2004
#25 0xb7b97561 in php_handler (r=0x8468fa0) at /usr/local/src/php-5.2.5/sapi/apache2handler/sapi_apache2.c:631
#26 0x08074127 in ap_run_handler (r=0x8468fa0) at config.c:157
#27 0x08077217 in ap_invoke_handler (r=0x8468fa0) at config.c:372
#28 0x0808dd98 in ap_process_request (r=0x8468fa0) at http_request.c:258
#29 0x0808affe in ap_process_http_connection (c=0x8462ed8) at http_core.c:190
#30 0x0807b0b7 in ap_run_process_connection (c=0x8462ed8) at connection.c:43
#31 0x080a1464 in child_main (child_num_arg=<value optimized out>) at prefork.c:640
#32 0x080a175a in make_child (s=<value optimized out>, slot=48) at prefork.c:736
#33 0x080a208e in ap_mpm_run (_pconf=0x80ec0a8, plog=0x812a1a0, s=0x80f0ce0) at prefork.c:871
#34 0x08061b6f in main (argc=135176352, argv=0x8460d00) at main.c:730
 [2008-10-27 19:12 UTC] steveh at brendata dot co dot uk
I'm seeing the same issue, also, the original poster has supplied the required information but has not changed the status so this may have been missed?

php -v

PHP 5.2.4-2ubuntu5.3 with Suhosin-Patch 0.9.6.2 (cli) (built: Jul 23 2008 06:44:49)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
    with Xdebug v2.0.3, Copyright (c) 2002-2007, by Derick Rethans

php -m

[PHP Modules]
bcmath
bz2
calendar
ctype
date
dba
dom
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
json
libxml
mbstring
mime_magic
mysql
mysqli
ncurses
openssl
pcntl
pcre
PDO
pdo_mysql
posix
readline
Reflection
session
shmop
SimpleXML
soap
sockets
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xdebug
xml
xmlreader
xmlwriter
zip
zlib

[Zend Modules]
Xdebug
 [2008-11-14 21:48 UTC] shire@php.net
Looks like this is fixed in php-5.2.6+ (I just tested this).  Can you please verify if this is still an open issue for you as well using latest CVS or php-5.2.6+

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 17 07:01:31 2025 UTC