aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJoe Mooring <[email protected]>2024-05-14 05:05:11 -0700
committerBjørn Erik Pedersen <[email protected]>2024-05-14 14:16:58 +0200
commit6dbbe6dd3a4b84856aa477b07ec69e948a952a6a (patch)
tree4e77c53582e5b745d876051d6c90c0ab8bde3bb4
parente2d66e3218e180bbfca06ca3a29ce01957c513e9 (diff)
downloadhugo-6dbbe6dd3a4b84856aa477b07ec69e948a952a6a.tar.gz
hugo-6dbbe6dd3a4b84856aa477b07ec69e948a952a6a.zip
resources/images: Handle NaN EXIF latitude and longitude
Fixes #12490
-rw-r--r--resources/images/exif/exif.go7
1 files changed, 7 insertions, 0 deletions
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}