Page MenuHomePhabricator

Fatal error: imagecreatefromjpeg(): gd-jpeg: JPEG library reports unrecoverable error if the image size is somehow 0 bytes
Closed, ResolvedPublic

Description

The following line starts appearing on my wiki after upgrading my PHP to 7.0.22

Fatal error: imagecreatefromjpeg(): gd-jpeg: JPEG library reports unrecoverable error: Empty input file in /var/www/html/pages/includes/media/Bitmap.php on line 342

MediaWiki version is 1.26

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptDec 8 2017, 5:11 AM
Nischayn22 updated the task description. (Show Details)Dec 8 2017, 5:12 AM

On further debugging it seems that I have GD installed and the only problem is that the image size was somehow 0 bytes. I am using LocalS3Rep extension and it could be a bug in that extension causing the size 0.

Anyways, I modified the following and could get past the error. Changed:

if ( !file_exists( $params['srcPath'] ) ) {

To:

if ( !file_exists( $params['srcPath'] ) || filesize( $params['srcPath'] ) == 0 ) {
Aklapper renamed this task from Fatal error: imagecreatefromjpeg(): gd-jpeg: JPEG library reports unrecoverable error to Fatal error: imagecreatefromjpeg(): gd-jpeg: JPEG library reports unrecoverable error if the image size is somehow 0 bytes.Dec 8 2017, 6:10 PM
Aklapper added a project: good first bug.
Restricted Application added a subscriber: TerraCodes. · View Herald TranscriptDec 8 2017, 6:10 PM

Change 412826 had a related patch set uploaded (by Dmattern; owner: Dmattern):
[mediawiki/core@master] GD zero filesize error

https://gerrit.wikimedia.org/r/412826

dmattern triaged this task as Normal priority.Feb 20 2018, 12:20 AM

Change 412833 had a related patch set uploaded (by Dmattern; owner: Dmattern):
[mediawiki/core@master] Adding missing entry in qqq.json

https://gerrit.wikimedia.org/r/412833

Change 412826 merged by jenkins-bot:
[mediawiki/core@master] GD zero filesize error

https://gerrit.wikimedia.org/r/412826

dmattern closed this task as Resolved.Feb 20 2018, 4:17 AM