php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #52212 ImageCreateFromJPEG crashes web server when incorrect image format provided
Submitted: 2010-06-30 16:44 UTC Modified: 2013-02-18 00:34 UTC
Votes:15
Avg. Score:4.9 ± 0.2
Reproduced:15 of 15 (100.0%)
Same Version:8 (53.3%)
Same OS:10 (66.7%)
From: phpbug at cano dot sk Assigned: pajoye (profile)
Status: No Feedback Package: GD related
PHP Version: 5.3.2 OS: Windows XP
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2010-06-30 16:44 UTC] phpbug at cano dot sk
Description:
------------
Call ImageCreateFromJPEG crashes web server when provided with invalid image.
In this test scenario http://dl.dropbox.com/u/2807353/phpbugreport.zip image provided is in PNG format. Image size is 300x300x24. My memory_limit = 256M ImageCreateFromJPEG should return FALSE when called with invalid data, instead it crashes web server.

Unhandled exception at 0x7c90108d in httpd.exe: 0xC0000005: Access violation writing location 0x01547104.

Test script:
---------------
<?php

// you can download actual image and script from here: 
// http://dl.dropbox.com/u/2807353/phpbugreport.zip

$moo = ImageCreateFromJPEG('img.jpg');

?>

Expected result:
----------------
ImageCreateFromJPEG() should return FALSE not crash webserver

Actual result:
--------------
Web server crashes

Unhandled exception at 0x7c90108d in httpd.exe: 0xC0000005: Access violation writing location 0x01547104.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-06-30 20:53 UTC] felipe@php.net
-Package: *Graphics related +Package: GD related
 [2010-06-30 22:35 UTC] pajoye@php.net
-Status: Open +Status: Feedback
 [2010-06-30 22:35 UTC] pajoye@php.net
Sounds like it happens only with the 5.3 VC6 versions of our builds. Which webserver and SAPI do you use?
 [2010-06-30 22:50 UTC] phpbug at cano dot sk
-Status: Feedback +Status: Open
 [2010-06-30 22:50 UTC] phpbug at cano dot sk
Apache/2.2.11 (Win32) PHP/5.3.2 

apache2handler
 [2010-06-30 23:28 UTC] pajoye@php.net
For an immediate fix you can use the VC9 version of apache and php. Fetch Apache at http://apachelounge.com.
 [2010-12-29 18:10 UTC] alex at phpguide dot co dot il
Applies to PHP 5.3.4 & Apache 2.2.17
Appears critical, especially on virtual hosts.
 [2010-12-29 18:25 UTC] pajoye@php.net
@alex at phpguide dot co dot il

Use VC9 builds.
 [2012-03-12 20:01 UTC] alexey at zhilchikov dot ru
OS: OpenSuSE Linux 11.3
PHP: 5.3.3, 5.3.2
Apache: 2.2

imagecreatefromjpeg() crashes apache always, not only with invalid JPEG file.
 [2012-03-12 20:20 UTC] pajoye@php.net
@alexey at zhilchikov dot ru

please provide one image file you use to crash apache then.
 [2012-03-12 20:20 UTC] pajoye@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: pajoye
 [2013-02-18 00:34 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 00:01:29 2024 UTC