emacs-pretest-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: image-jpeg-p is buggy


From: John Paul Wallington
Subject: Re: image-jpeg-p is buggy
Date: Tue, 26 Aug 2003 16:42:15 +0100

> Evaluating
>       (create-image "car.jpg")
> causes the following error:
> Debugger entered--Lisp error: (args-out-of-range "...")
>   byte-code("...")
>   image-jpeg-p("...")
>   image-type-from-data("...")
>   image-type-from-file-header("car.jpg")
>   create-image("car.jpg")
>   eval((create-image "car.jpg"))
> 
> I think aref() in image-jpeg-p() refers a position over 256 while the
> length of the data is 256.

Thanks for your report.  I've installed this change:

RCS file: /cvsroot/emacs/emacs/lisp/image.el,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- emacs/emacs/lisp/image.el   2003/02/04 11:27:37     1.35
+++ emacs/emacs/lisp/image.el   2003/08/26 15:36:50     1.36
@@ -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))))))))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]