Make WordPress Core

Opened 13 years ago

Closed 13 years ago

#5397 closed defect (bug) (fixed)

exif_read_data() called for non-jpeg/tiff image files, resulting in error

Reported by: fitztrev Owned by: westi
Milestone: 2.5 Priority: high
Severity: major Version: 2.5
Component: Administration Keywords: has-patch
Focuses: Cc:


exif_read_data(), added in #5162, only accepts JPEG and TIFF files but is being called for GIF and PNG as well.

When uploading a GIF file (ex: the Google logo) via the Write Post upload form, I'm getting the following error message:

Warning: exif_read_data(logo.gif) [function.exif-read-data]: File not supported in /var/www/trunk/wp-admin/includes/image.php on line 291

Attachments (2)

5397.exif.suppress-errors.diff (877 bytes) - added by DD32 13 years ago.
5397.exif.the-proper-way.diff (1.7 KB) - added by DD32 13 years ago.

Download all attachments as: .zip

Change History (11)

#1 @DD32
13 years ago

Confirmed with a .bmp on PHP5.2.4 + Apache/win32

Given that the filetypes that the exif functions accept might change between installs/versions (i'm honestly not sure), I think the best method might to suppress the errors, That works fine here and allows the upload to go ahead as usual.

#2 @DD32
13 years ago

  • Keywords has-patch added
  • Version set to 2.4

#3 @darkdragon
13 years ago

Suppressing errors is never sexy.

If I was going to make a patch, I would explicitly check for either GIF and TIFF and run that through a filter.

However, since I'm not going to make a patch to counter yours, then I think yours is sexy... enough.

#4 @DD32
13 years ago

I agree that error suppressing is never sexy, So i'll attach another patch without it.

#5 @darkdragon
13 years ago

Your first patch covered two areas or functions. Your second, while sexier, only covers one of the areas/functions. Is this intentional?

Line 273 - iptcparse() (not covered)
Line 291 - exif_read_data() (covered)

#6 @DD32
13 years ago

Yep, Its intentional, The first function(iptcparse()) is not called unless there is data for it to parse( $infoAPP13? from getimagesize() ).

#7 @darkdragon
13 years ago

That is one fine patch then.

#8 @westi
13 years ago

  • Owner changed from anonymous to westi
  • Status changed from new to assigned

#9 @westi
13 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [6438]) Ensure we don't call exif_read_data() on unsupported file types. Fixes #5397 props DD32

Note: See TracTickets for help on using tickets.