Bug #17651 Updated: fread doesn't handle error conditions of streams (e.g. bz2 decompression)
| From: | mfischer@php.net | Date: | Sat, 08 Jun 2002 02:05:40 +0000 |
| Subject: | Bug #17651 Updated: fread doesn't handle error conditions of streams (e.g. bz2 decompression) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-9812@lists.php.net to get a copy of this message | ||
ID: 17651
Updated by: mfischer@php.net
Reported By: mfischer@php.net
Status: Critical
Bug Type: Filesystem function related
Operating System: All
PHP Version: 4.0CVS-2002-06-07
New Comment:
Crap formatting, here's the text again:
In its current state, fread delegates the actual read call to
php_stream_read.
It assumes that the return value of php_stream_read() is always >= 0
(this can
be easily seen because it writes the return value directly in the
length field
of the allocated buffer). But there are cases when php_stream_read()
returns
e.g. -1, for example compress.bzip2 can't decompress the stream on a
read (just
test this with a file you pretend it's an bz2 but it's just a php
source).
I also think the impact is wrote then just fread(). I've seen a few
places in
streams.c where only == 0 is used for checking an error condition in
the code.
Previous Comments:
------------------------------------------------------------------------
[2002-06-07 22:04:19] mfischer@php.net
In its current state, fread delegates the actual read call to
php_stream_read.
It assumes that the return value of php_stream_read() is always >= 0
(this can be easily seen
because it
writes the return value directly in the length field of the
allocated buffer). But there are cases when php_stream_read() returns
e.g. -1,
for example compress.bzip2 can't
decompress the stream on a read (just test
this with a file you pretend it's an bz2 but it's just a php
source).
I also think the impact is wrote then just fread(). I've seen a few
places in
streams.c where only == 0 is used for checking an error condition in
the code.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=17651&edit=1