Skip to content
This repository has been archived by the owner on Feb 10, 2022. It is now read-only.

Commit

Permalink
Err if rational has a 0-valued denominator
Browse files Browse the repository at this point in the history
Encountering panics when ExposureTime values have a denominator of 0 in the RatVal. This change adds a sanity check to ensure that we error appropriately.
  • Loading branch information
rodaine committed Jul 31, 2015
1 parent 709fab3 commit 0c31501
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tiff/tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,9 @@ func (t *Tag) Rat(i int) (*big.Rat, error) {
if err != nil {
return nil, err
}
if d == 0 {
return nil, errors.New("rational has zero-valued denominator")
}
return big.NewRat(n, d), nil
}

Expand Down

0 comments on commit 0c31501

Please sign in to comment.