#27511 [Opn]: fread crashes Apache with mistakenly big length

From: Date: Sat, 06 Mar 2004 12:07:51 +0000
Subject: #27511 [Opn]: fread crashes Apache with mistakenly big length
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-55984@lists.php.net to get a copy of this message
ID: 27511 User updated by: patrick at borgeat dot de Reported By: patrick at borgeat dot de Status: Open Bug Type: Filesystem function related Operating System: Windows 2000 SR4 PHP Version: 5.0.0b4 (beta4) New Comment: I forgot a Semikolon (;) after "echo $res", sorry! Previous Comments: ------------------------------------------------------------------------ [2004-03-06 04:53:43] patrick at borgeat dot de 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 this bug report at http://bugs.php.net/?id=27511&edit=1

« previous php.bugs (#55984) next »