#36363 [Opn]: php gets segv in _php_stream_read/memcpy

From: Date: Sat, 11 Feb 2006 00:47:10 +0000
Subject: #36363 [Opn]: php gets segv in _php_stream_read/memcpy
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-93149@lists.php.net to get a copy of this message
ID: 36363 Updated by: pajoye@php.net Reported By: holgerk44 at freenet dot de Status: Open Bug Type: Reproducible crash Operating System: RHEL 4 PHP Version: 5.1.2 New Comment: It should not segfault but I think you misuse fread. I suppose your "photo" field is a binary object containing images? Then simply use file_put_contents to store them back to the filesystem. As a sidenote, use error_reporting(E_ALL) in you script. Previous Comments: ------------------------------------------------------------------------ [2006-02-11 00:25:09] holgerk44 at freenet dot de 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 this bug report at http://bugs.php.net/?id=36363&edit=1

« previous php.bugs (#93149) next »