Re: PHP (anti) crash policy?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

On 10/01/2004 11:42 AM, Olaf Van Der Spek wrote:
If it is not normal, why don't you just evaluate the expected memory size that is going to be allocated before calling the PHP function that does it and handle the situation within your PHP code?

Because I've no idea how gzinflate decides how much memory to allocate.



Use worse case estimates. AFAIK, that algorithm can only compress upto 5:1 . If you are taking data from a file, read the file size and multiply by 5 . If the resulting case exceeds the reasonable memory limit, you should not bother to even try opening that way.


I know. But the crashing input is just 144 kb.

Therefore it seems corrupted.


It's an invalid stream, but I do expect my script not to crash when it encounters such a stream.

I suspect that it is not PHP engine code fault for the request to allocate the invalid amount of memory. It seems to me that it is up to gzip libraries that PHP links to that need to be fixed, if possible, detecting data corruption and failing cleanly because it seems that PHP is not aware that the data is corrupted.



--

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux