]> code.delx.au - gnu-emacs/blobdiff - lisp/image.el
Merged in changes from CVS trunk.
[gnu-emacs] / lisp / image.el
index ac1ef557edc28b25d7fd3747ef56faf83d191573..0e71bd4a349ab5be5943079b163ca238b80067f8 100644 (file)
@@ -46,7 +46,7 @@ When the first bytes of an image file match REGEXP, it is assumed to
 be of image type IMAGE-TYPE if IMAGE-TYPE is a symbol.  If not a symbol,
 IMAGE-TYPE must be a pair (PREDICATE . TYPE).  PREDICATE is called
 with one argument, a string containing the image data.  If PREDICATE returns
-a non-nil value, TYPE is the image's type ")
+a non-nil value, TYPE is the image's type.")
 
 
 (defun image-jpeg-p (data)
@@ -66,8 +66,9 @@ We accept the tag Exif because that is the same format."
                (code (aref data i)))
            (when (and (>= code #xe0) (<= code #xef))
              ;; APP0 LEN1 LEN2 "JFIF\0"
-             (throw 'jfif 
-                    (string-match "JFIF\\|Exif" (substring data i (+ i nbytes)))))
+             (throw 'jfif
+                    (string-match "JFIF\\|Exif"
+                                  (substring data i (min (+ i nbytes) len)))))
            (setq i (+ i 1 nbytes))))))))
 
 
@@ -292,4 +293,5 @@ Example:
 
 (provide 'image)
 
+;;; arch-tag: 8e76a07b-eb48-4f3e-a7a0-1a7ba9f096b3
 ;;; image.el ends here