[Top][All Lists]

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

Re: C file recoginzed as image file

From: Juanma Barranquero
Subject: Re: C file recoginzed as image file
Date: Fri, 19 Jan 2007 18:10:47 +0100

On 1/19/07, Jason Rumney <address@hidden> wrote:

OK. I didn't look closely enough to determine for sure, just thought I'd
raise the alarm for whoever implemented this to check that their fix
really prevented the bugs it was intended to. It looks like it is
probably a straightforward case of avoiding displaying the image then.

This is an example patch that implements the idea discussed. It's as
simple as it gets. I'm not entirely happy because I don't like the
idea of perverting `magic-mode-alist' to set a minor mode instead of a
major mode, but perhaps it can be accepted as a special deal for the
potentially-dangerous image libraries.

Of course, if this is accepted some other function's docstrings would
need a little bit of polishing.


Index: lisp/files.el
RCS file: /cvsroot/emacs/emacs/lisp/files.el,v
retrieving revision 1.877
diff -u -2 -r1.877 files.el
--- lisp/files.el       6 Jan 2007 21:50:14 -0000       1.877
+++ lisp/files.el       19 Jan 2007 16:32:03 -0000
@@ -2128,5 +2128,5 @@

(defvar magic-mode-alist
-  `((image-type-auto-detected-p . image-mode)
+  `((image-type-auto-detected-p . image-minor-mode)
    ;; The < comes before the groups (but the first) to reduce backtracking.
    ;; TODO: UTF-16 <?xml may be preceded by a BOM 0xff 0xfe or 0xfe 0xff.
Index: lisp/image-mode.el
RCS file: /cvsroot/emacs/emacs/lisp/image-mode.el,v
retrieving revision 1.15
diff -u -2 -r1.15 image-mode.el
--- lisp/image-mode.el  29 Aug 2006 13:02:53 -0000      1.15
+++ lisp/image-mode.el  19 Jan 2007 16:52:14 -0000
@@ -127,6 +127,6 @@
(defun image-toggle-display ()
  "Start or stop displaying an image file as the actual image.
-This command toggles between showing the text of the image file
-and showing the image as an image."
+This command toggles between showing the text of the image file and
+showing the image as an image.  NOTE: This can be a SECURITY RISK."
  (if (get-text-property (point-min) 'display)
@@ -180,4 +180,6 @@
          (message "Repeat this command to go back to displaying the file as

+(put 'image-toggle-display 'disabled t)
(provide 'image-mode)

reply via email to

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