# HG changeset patch # User John Paul Wallington # Date 1061912210 0 # Node ID f1fd0b3a923ebe2243b2ee69cd9a0cf16354ea4a # Parent 93c27fd633024b5537bd91008fa9e3296512be34 (image-jpeg-p): Don't search beyond length of data. diff -r 93c27fd63302 -r f1fd0b3a923e lisp/image.el --- 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))))))))