Skip to content

Commit

Permalink
resources/images: Handle NaN EXIF latitude and longitude
Browse files Browse the repository at this point in the history
Fixes #12490
  • Loading branch information
jmooring authored and bep committed May 14, 2024
1 parent e2d66e3 commit 6dbbe6d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions resources/images/exif/exif.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"bytes"
"fmt"
"io"
"math"
"math/big"
"regexp"
"strings"
Expand Down Expand Up @@ -140,6 +141,12 @@ func (d *Decoder) Decode(r io.Reader) (ex *ExifInfo, err error) {

if !d.noLatLong {
lat, long, _ = x.LatLong()
if math.IsNaN(lat) {
lat = 0
}
if math.IsNaN(long) {
long = 0
}
}

walker := &exifWalker{x: x, vals: make(map[string]any), includeMatcher: d.includeFieldsRe, excludeMatcher: d.excludeFieldsrRe}
Expand Down

0 comments on commit 6dbbe6d

Please sign in to comment.