changeset 52344:f1fd0b3a923e

(image-jpeg-p): Don't search beyond length of data.
author John Paul Wallington <jpw@pobox.com>
date Tue, 26 Aug 2003 15:36:50 +0000
parents 93c27fd63302
children 54c9ee5b83d8
files lisp/image.el
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/image.el	Tue Aug 26 11:54:09 2003 +0000
+++ b/lisp/image.el	Tue Aug 26 15:36:50 2003 +0000
@@ -67,7 +67,8 @@
 	    (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))))))))