summaryrefslogtreecommitdiff
path: root/lisp/image.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/image.el')
-rw-r--r--lisp/image.el3
1 files changed, 2 insertions, 1 deletions
diff --git a/lisp/image.el b/lisp/image.el
index 25d05c9902f..5f603ccdd12 100644
--- a/lisp/image.el
+++ b/lisp/image.el
@@ -67,7 +67,8 @@ We accept the tag Exif because that is the same format."
(when (and (>= code #xe0) (<= code #xef))
;; APP0 LEN1 LEN2 "JFIF\0"
(throw 'jfif
- (string-match "JFIF\\|Exif" (substring data i (+ i nbytes)))))
+ (string-match "JFIF\\|Exif"
+ (substring data i (min (+ i nbytes) len)))))
(setq i (+ i 1 nbytes))))))))