php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28639 imageCreateFromGif infinite loop. max processor
Submitted: 2004-06-05 05:55 UTC Modified: 2005-10-10 10:56 UTC
Votes:6
Avg. Score:3.7 ± 0.7
Reproduced:5 of 6 (83.3%)
Same Version:1 (20.0%)
Same OS:2 (40.0%)
From: jim at bluedojo dot com Assigned: pajoye (profile)
Status: Not a bug Package: GD related
PHP Version: 4.3.7 OS: Windows XP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: jim at bluedojo dot com
New email:
PHP Version: OS:

 

 [2004-06-05 05:55 UTC] jim at bluedojo dot com
Description:
------------
For some reason, this gif causes the processor to max out at 100% when imageCreateFromGif() function is used.




Reproduce code:
---------------
<?

imageCreateFromGif("http://members.tripod.com/~TyroneZero/drstrangelove.gif");

?>

Expected result:
----------------
Creates a GD image

Actual result:
--------------
Infinite Loop.  Maxes out processor.  Causes operating system to stall.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-06-05 20:00 UTC] jim at bluedojo dot com
This picture also causes processor to max out:

http://www.geocities.com/Tokyo/Palace/5677/riiya1.gif
 [2004-06-06 18:32 UTC] iliaa@php.net
The 2 gif images you've offered are corrupt, and I cannot 
replicate the cpu usage you are reporting.  
 [2004-06-06 20:04 UTC] jim at bluedojo dot com
Yes, the images are corrupt.  I believe that is why the function imageCreateFromGif() is going into an infinite loop.  I need to have the function just exit and not loop infinitely.

When I run the php page from the command line it goes into an infinite loop.  When I load the php page from an Apache web server, it causes Apache to stall infinitely.  My processor maxes out and I have to go to the Windows Task Menu to cancel the process.

I am running the following:

Windows XP
Apache/1.3.28
PHP/4.3.7 
GD library is turned on in php.ini

Any help would be greatful.  Thanks.
 [2004-06-14 14:02 UTC] vrana@php.net
It seems this is Windows specific issue caused most probably by php_gd2.dll.
 [2004-06-15 12:45 UTC] iridium at beyondunreal dot com
I have reproduced this bug using

php -r "imagecreatefromgif('http://members.tripod.com/~TyroneZero/drstrangelove.gif');"

on both windows xp in PHP 5.0.0rc2
and linux with 4.3.6
(both command line).

The above command causes it to hang. Tracing through the code using a debugger it does look a lot like an infinate loop, though it could just be a really long one.

I believe the infinate loop starts at line 155 in gd_gif_in.c at 

for (;;) {

- I think it may just not be reaching an exit condition.

I may investigate more later.

Very strangely, if I download the gif and run the same command without going to the site at runtime, there is no such problem.

Irid.
 [2004-06-18 17:15 UTC] scottmacvicar at ntlworld dot com
Problem is in GetDataBlock_ it doesn't even return -1 so constantly loops within the end code handling part of LWZReadByte_

while ((count = GetDataBlock(fd, buf)) > 0)
is the loop in question in libgd/gd_gif_in.c

I dont have enough time to see whats wrong with that function but its there its looping.
 [2005-01-14 18:51 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-STABLE-latest.zip

Can not reproduce.

 [2005-01-22 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2005-03-09 23:11 UTC] ericvanblokland at gmail dot com
I've experienced this bug with latest stable php5 release. However, I do not believe the gif is corrupted, just odd formated (which you may very well call corrupt if you like). Due to the fact most programs just read these gifs whatsoever, as well as create them, our "stupid" customers will continue using them. Would be nice to be able to work with them or rejecting them without timeing out the script.
 [2005-03-09 23:12 UTC] ericvanblokland at gmail dot com
PS: how do I re-open this bug?
 [2005-10-10 10:48 UTC] thegobot at gmail dot com
imagecreatefromgif("img.gif");
Child process of Apache usage 95% CPU and infinite loop
The img.gif is corrupt
 [2005-10-10 10:56 UTC] pajoye@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

Duplicate of #33220.

Partiallly fixed there, please try snapshots.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 03 17:01:32 2024 UTC