emacs-devel
[Top][All Lists]
Advanced

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

Re: C file recoginzed as image file


From: Jason Rumney
Subject: Re: C file recoginzed as image file
Date: Sun, 07 Jan 2007 11:49:21 +0000
User-agent: Thunderbird 1.5.0.9 (Windows/20061207)

Richard Stallman wrote:
    > Besides which, a jpg file starts with characters that don't make any
    > sense at the start of a C file.  So if it looks like a plausible C
    > file, it won't be treated as a jpeg.

    If it looks like a plausible C file to who?

To anyone who knows C.  The first two characters of a JPG file are
character codes above 128, that would obviously be invalid in C.

The user cannot see those first two characters until they load the file. If it is in fact a dangerous jpg file, they will not find out until too late. If my patch to use image-mode-maybe for magic-mode-alist is installed, this will not happen for file extensions that the user might reasonably expect to be something other than an image. But it will still happen for unknown file extensions, which in some cases (.thm files, or thumbnails without an extension) will be considered a good thing, but there may also be cases where a user receives a file with an unknown extension and opens it in Emacs to see the file contents to decide what type of file it is, expecting Emacs to be a safe way of checking such files. So maybe it would be better to define a new function `image-mode-confirm' which always asks the user before using image-mode on a file, and using that for magic-mode-alist and other uses which could be considered risky.






reply via email to

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