From: Joe Mooring Date: Tue, 14 May 2024 12:05:11 +0000 (-0700) Subject: resources/images: Handle NaN EXIF latitude and longitude X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=6dbbe6dd3a4b84856aa477b07ec69e948a952a6a;p=brevno-suite%2Fhugo resources/images: Handle NaN EXIF latitude and longitude Fixes #12490 --- diff --git a/resources/images/exif/exif.go b/resources/images/exif/exif.go index af92366ca..0374cdc96 100644 --- a/resources/images/exif/exif.go +++ b/resources/images/exif/exif.go @@ -17,6 +17,7 @@ import ( "bytes" "fmt" "io" + "math" "math/big" "regexp" "strings" @@ -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}