From: holgerk44 at freenet dot de
Operating system: RHEL 4
PHP version: 5.1.2
PHP Bug Type: Reproducible crash
Bug description: php gets segv in _php_stream_read/memcpy
Description:
------------
trying to read large database objects (>64K) via PDO from an informix
database via a stream causes a crash of the php executable
Reproduce code:
---------------
$query=$dbh->query("select * from large ");
$row=$query->fetch(PDO::FETCH_ASSOC);
while ( $row ) {
$file = fopen ("/tmp/large.photo.$count","w");
$test=fread($row["PHOTO"],20000);
while($test) {
fwrite ( $file, $test) ;
$test=fread($row["PHOTO"],20000);
}
fclose ( $file);
}
Expected result:
----------------
an error in case of misprogramming.
Actual result:
--------------
#0 0x007933dc in memcpy () from /lib/tls/libc.so.6
#1 0x081db395 in _php_stream_read (stream=0x97a4ffd, buf=0x9794d3d "",
size=3219790640)
at /home/php/main/streams/streams.c:618
#2 0x08180fa3 in zif_fread (ht=2, return_value=0x9760b6c,
return_value_ptr=0x0, this_ptr=0x0, return_value_used=1)
at /home/php/ext/standard/file.c:1811
#3 0x082192ec in zend_do_fcall_common_helper_SPEC
(execute_data=0xbfeaa650)
at /home/php/Zend/zend_vm_execute.h:192
--
Edit bug report at http://bugs.php.net/?id=36363&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=36363&r=trysnapshot44
Try a CVS snapshot (PHP 5.1):
http://bugs.php.net/fix.php?id=36363&r=trysnapshot51
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=36363&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=36363&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=36363&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=36363&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=36363&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=36363&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=36363&r=support
Expected behavior: http://bugs.php.net/fix.php?id=36363&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=36363&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=36363&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=36363&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36363&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=36363&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=36363&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=36363&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=36363&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=36363&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=36363&r=mysqlcfg