6.0.0-beta1
7/18/25

[#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 12/08/2009 (5701 days ago)
Due
Updated 01/13/2010 (5665 days ago)
Assigned 12/09/2009 (5700 days ago)
Resolved 12/13/2009 (5696 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch Yes

History
01/13/2010 12:17:46 AM CVS Commit Comment #7 Reply to this comment
12/13/2009 11:45:03 PM 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!
12/13/2009 11:38:31 PM 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
12/09/2009 10:44:00 AM 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
12/09/2009 01:32:11 AM 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!
12/08/2009 11:19:47 PM Chuck Hagenbuch State ⇒ Assigned
Assigned to Michael Rubinsky
 
12/08/2009 10:42:07 PM jon (at) spriggs (dot) org (dot) uk Comment #1
Priority ⇒ 1. Low
Type ⇒ Bug
Summary ⇒ Divide by zero error in /ansel/lib/Exif.php
Queue ⇒ Ansel
Milestone ⇒
Patch ⇒ Yes
New Attachment: diff.txt Download
State ⇒ Unconfirmed
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