Bug #17651: fread doesn't handle error conditions of streams (e.g. bz2 decompression)
| From: | mfischer@php.net | Date: | Sat, 08 Jun 2002 02:04:19 +0000 |
| Subject: | Bug #17651: fread doesn't handle error conditions of streams (e.g. bz2 decompression) | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-9810@lists.php.net to get a copy of this message | ||
From: mfischer@php.net
Operating system: All
PHP version: 4.0CVS-2002-06-07
PHP Bug Type: Filesystem function related
Bug description: fread doesn't handle error conditions of streams (e.g. bz2 decompression)
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 bug report at http://bugs.php.net/?id=17651&edit=1
--
Fixed in CVS: http://bugs.php.net/fix.php?id=17651&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=17651&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=17651&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=17651&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=17651&r=support
Expected behavior: http://bugs.php.net/fix.php?id=17651&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=17651&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=17651&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=17651&r=globals