6.0.0-git
2019-04-21

[#8761] Divide by zero error in /ansel/lib/Exif.php
Summary Divide by zero error in /ansel/lib/Exif.php
Queue Ansel
Queue Version 1.1
Type Bug
State Resolved
Priority 1. Low
Owners mrubinsk (at) horde (dot) org
Requester jon (at) spriggs (dot) org (dot) uk
Created 2009-12-08 (3421 days ago)
Due
Updated 2010-01-13 (3385 days ago)
Assigned 2009-12-09 (3420 days ago)
Resolved 2009-12-13 (3416 days ago)
Milestone
Patch Yes

History
2009-12-13 23:45:03 Michael Rubinsky Comment #6
State ⇒ Resolved
Reply to this comment
Seems like the php native exif functions return invalid data for some 
fields when the value is not defined in the image source. Fixed, 
though instead of returning zero like your patch did, we simply return 
from the function, since the value of x/0 is not 0, but undefined.

Thanks for the catch!
2009-12-13 23:38:31 CVS Commit Comment #4 Reply to this comment
Changes have been made in CVS for this ticket:

Protect from divide-by-zero errors due to faulty exif data.
Bug: 8761
Submitted by: jon (at) spriggs (dot) org (dot) uk
http://cvs.horde.org/diff.php/ansel/lib/Exif.php?rt=horde&r1=1.41.2.11&r2=1.41.2.12&ty=u
2009-12-09 10:44:00 jon (at) spriggs (dot) org (dot) uk Comment #3 Reply to this comment
Looks like there are lots of places in Exifer's original code that 
this should be checked...OTOH, the exif standard says that values 
for those fields shouldn't contain a zero denominator and are 
rational numbers. What is the source of the exif information that is 
broken? Can you upload a sample image file?
I'm on my phone right now which has uploads disabled. The file is at 
http://jon.spriggs.org.uk/exif_error.jpg
Also, please read docs/CODING_STANDARDS when submitting future 
patches, and thanks!
Will do.

Jon
2009-12-09 01:32:11 Michael Rubinsky Comment #2
State ⇒ Feedback
Reply to this comment
Looks like there are lots of places in Exifer's original code that 
this should be checked...OTOH, the exif standard says that values for 
those fields shouldn't contain a zero denominator and are rational 
numbers. What is the source of the exif information that is broken? 
Can you upload a sample image file?

Also, please read docs/CODING_STANDARDS when submitting future 
patches, and thanks!
2009-12-08 23:19:47 Chuck Hagenbuch Assigned to Michael Rubinsky
State ⇒ Assigned
 
2009-12-08 22:42:07 jon (at) spriggs (dot) org (dot) uk Comment #1
Type ⇒ Bug
State ⇒ Unconfirmed
Priority ⇒ 1. Low
Summary ⇒ Divide by zero error in /ansel/lib/Exif.php
Queue ⇒ Ansel
Milestone ⇒
Patch ⇒ Yes
New Attachment: diff.txt Download
Reply to this comment
There appears to be a bug in Exif.php where it doesn't check to see 
whether it's about to divide by zero when calculating the shutter 
speed. This patch fixes the issue in /ansel/lib/Exif.php.

Saved Queries