Ticket #5397 (closed defect (bug): fixed)

Opened 4 years ago

Last modified 4 years ago

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

Reported by: fitztrev Owned by: westi
Priority: high Milestone: 2.5
Component: Administration Version: 2.5
Severity: major Keywords: has-patch
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

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

Change History

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

DD324 years ago

comment:2   DD324 years ago

  • Keywords has-patch added
  • Version set to 2.4

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   DD324 years ago

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

DD324 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   DD324 years ago

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

That is one fine patch then.

  • Owner changed from anonymous to westi
  • Status changed from new to assigned
  • Status changed from assigned to closed
  • Resolution set to fixed

(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.