From:             patrick at borgeat dot de
Operating system: Windows 2000 SR4
PHP version:      5.0.0b4 (beta4)
PHP Bug Type:     Filesystem function related
Bug description:  fread crashes Apache with mistakenly big length 

Description:
------------
As I mistakenly tried to read a very large number of bytes (1078508183)
(more than are in the file) with fread, the Site doesn't react anymore and
i get a apache.exe Task in my Tasklist consuming an average of 80% CPU
Load (with a 1300 Mhz Machine) which can't be stopped (maybe also due to
missing rights). Also the file is blocked.



Never tested this on Linux, but I think if a server does this mistakenly
several times at once the whole server enviroment would crash.



I run Apache 2.0.48 with PHP 5.0.0b4 as Apache2 Handler on Windows 2000
SR4 on FAT32 Filesystem.

Reproduce code:
---------------
(in my case test was a textfile with the 3 Letters "AAA")



<?

$fp = fopen("test",r");

$res = fread($fp,1078508183);

echo $res

fclose($fp);

?>





Expected result:
----------------
I expected PHP to be as smart (as it is with smaller numbers for example
like 50 000) to write only 3 Bytes and output "AAA".

Actual result:
--------------
Apache Task isn't stopable and runs @ Average of 80% CPU Load

-- 
Edit bug report at http://bugs.php.net/?id=27511&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=27511&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=27511&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=27511&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=27511&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=27511&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=27511&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=27511&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=27511&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=27511&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=27511&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=27511&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=27511&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27511&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=27511&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=27511&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=27511&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=27511&r=float

Reply via email to