Bug #77195 [Dup->Opn]: Incorrect error handling of imagecreatefromjpeg function with corrupt jpeg
| From: | cmb@php.net | Date: | Fri, 23 Nov 2018 23:16:28 +0000 |
| Subject: | Bug #77195 [Dup->Opn]: Incorrect error handling of imagecreatefromjpeg function with corrupt jpeg | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-218118@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=77195&edit=1
ID: 77195
Updated by: cmb@php.net
Reported by: peehaa@php.net
Summary: Incorrect error handling of imagecreatefromjpeg
function with corrupt jpeg
-Status: Duplicate
+Status: Open
Type: Bug
Package: GD related
Operating System: Windows
PHP Version: Irrelevant
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
> Also note I am using the bundled gd lib
Ah, then the other ticket is certainly unrelated.
Previous Comments:
------------------------------------------------------------------------
[2018-11-23 20:10:33] peehaa@php.net
Also note I am using the bundled gd lib
------------------------------------------------------------------------
[2018-11-23 20:00:01] peehaa@php.net
How is this a dupe?
I am getting unexpected output (even when using the STFU operator).
The dupe is about getting an unexpected fatal error.
Am I missing something here?
------------------------------------------------------------------------
[2018-11-23 17:42:33] cmb@php.net
This looks like a duplicate of bug #75888.
------------------------------------------------------------------------
[2018-11-23 15:11:53] peehaa@php.net
Description:
------------
The imagecreatefromjpeg function improperly handles errors when passing a corrupt jpeg image.
Not only does it still output an error (coming from gd directly I guess), but it also spits out 3
PHP errors (1 notice and 2 warnings).
Test script:
---------------
Test image can be found at https://pieterhordijk.com/broken-mspaint.jpeg
@imagecreatefromjpeg('/path/to/broken-mspaint.jpeg');
imagecreatefromjpeg('/path/to/broken-mspaint.jpeg');
Expected result:
----------------
First call with the STFU operator should output nothing.
Second call without the STFU operators should probably just give one single php error instead of 3
Actual result:
--------------
First call with the STFU operator:
JPEG datastream contains no image
Second call without the STFU operator:
PHP Notice: imagecreatefromjpeg(): gd-jpeg, libjpeg: recoverable error: Corrupt JPEG data: 947
extraneous bytes before marker 0xd9
in /path/to/test.php on line 5
PHP Warning: imagecreatefromjpeg(): gd-jpeg: JPEG library reports unrecoverable error: in
/path/to/test.php on line 5
JPEG datastream contains no image
PHP Warning: imagecreatefromjpeg(): '/path/to/image/broken-mspaint.jpeg' is not a valid
JPEG file in /path/to/test.php on line 5
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=77195&edit=1