Closed Bug 304521 Opened 19 years ago Closed 15 years ago

incorrect xbitmap (xbm) identification

Categories

(Core :: Graphics: ImageLib, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: gjdsj, Unassigned)

References

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.10) Gecko/20050716 Firefox/1.0.6
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.10) Gecko/20050716 Firefox/1.0.6

When viewing files on the local filesystem using "file:", some C/C++ are
incorrectly identified as XBitmap files if they begin with "#define".

The problem is in "modules/libpr0n/src/imgLoader.cpp" on line 772.

"else if (aLength >= 8 && !nsCRT::strncmp(aContents, "#define ", 8)) {
    aContentType.Assign(NS_LITERAL_CSTRING("image/x-xbitmap"));
  }"

Some stricter checking could eliminate this problem. For example, it could check
that the file extension was "xbm" instead... I'm not familiar with Firefox's
internals, though.

Reproducible: Always

Steps to Reproduce:
1. Attempt to open a file beginning with "#define" that is not an XBitmap file
on the local filesystem.
Actual Results:  
The file was misidentified as an XBitmap file.

Expected Results:  
Identified the file as plain text.
WFM with Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.9a9pre) Gecko/2007100804 Minefield/3.0a9pre

Can you reproduce this with the latest trunk builds? If not, please resolve this bug as WORKSFORME.

Thanks!
Whiteboard: CLOSEME 09/30
It's very easy to reproduce, just create a file (without filename extension)
containing "#define X" and open it using file://

It seems intentional though:
http://bonsai.mozilla.org/cvsblame.cgi?file=/mozilla/modules/libpr0n/src/imgLoader.cpp&rev=1.94&root=/cvsroot&mark=787-788#733
Component: File Handling → ImageLib
Product: Firefox → Core
QA Contact: file.handling → imagelib
Whiteboard: CLOSEME 09/30
I can confirm this bug. I'll be getting rid of XBM support soon, which should fix this.
Depends on: 504822
Status: UNCONFIRMED → NEW
Ever confirmed: true
XBM support was removed in bug 504822. Resolving fixed.
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.