From:             ronald dot muller at gmail dot com
Operating system: apache
PHP version:      5.2.9
PHP Bug Type:     GD related
Bug description:  imagecreatefromjpeg() crashes i.s.o. return FALSE

Description:
------------
imagecreatefromjpeg() should return FALSE on errors (as documented), not
crash - hence aborting the php script.

http://www.plasticdaisy.net/dlvs/dlvs.php?c=pr
shows "Fatal error: Allowed memory size of 33554432 bytes exhausted" and
aborts the script.

The crash occurs because memory_limit is exceeded, as mentioned in
previous submissions on the same bug. In the example case a 3.8MB jpg is
expanded internally to somewhere in between 32MB and 64MB. Increasing the
memory_limit does not solve the bug, it merely hides it again. The function
should be made according to spec, i.e. return FALSE. Then the php script
can act properly on this error.

Reproduce code:
---------------
ini_set('memory_limit', $TOO_SMALL);

$someVar = imagecreatefromjpeg($img);

echo $someVar;

Expected result:
----------------
return FALSE i.s.o. crash, as documented.

Actual result:
--------------
Fatal error: Allowed memory size of 33554432 bytes exhausted

http://www.plasticdaisy.net/dlvs/dlvs.php?c=pr

-- 
Edit bug report at http://bugs.php.net/?id=48179&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        
http://bugs.php.net/fix.php?id=48179&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        
http://bugs.php.net/fix.php?id=48179&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        
http://bugs.php.net/fix.php?id=48179&r=trysnapshot60
Fixed in CVS:                        
http://bugs.php.net/fix.php?id=48179&r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=48179&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=48179&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=48179&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=48179&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=48179&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=48179&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=48179&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=48179&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=48179&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=48179&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=48179&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=48179&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=48179&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=48179&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=48179&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=48179&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=48179&r=mysqlcfg

Reply via email to