WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 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:

Description

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 6 years ago.
5397.exif.the-proper-way.diff (1.7 KB) - added by DD32 6 years ago.

Download all attachments as: .zip

Change History (11)

comment:1 DD326 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.

comment:2 DD326 years ago

  • Keywords has-patch added
  • Version set to 2.4

comment:3 darkdragon6 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.

comment:4 DD326 years ago

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

comment:5 darkdragon6 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)

comment:6 DD326 years ago

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

comment:7 darkdragon6 years ago

That is one fine patch then.

comment:8 westi6 years ago

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

comment:9 westi6 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.