Bug 758429 - file command incorrectly identifies a JPEG file as being a Minix filesystem
Summary: file command incorrectly identifies a JPEG file as being a Minix filesystem
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: file
Version: 5.5
Hardware: All
OS: Linux
low
low
Target Milestone: rc
: 5.5
Assignee: Jan Kaluža
QA Contact: BaseOS QE Security Team
URL:
Whiteboard:
Depends On:
Blocks: 771700 772019
TreeView+ depends on / blocked
 
Reported: 2011-11-29 19:25 UTC by Alan Staples
Modified: 2012-10-29 13:02 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: Minix magic pattern has the same beginning as the JPEG magic pattern and File tries to match Minix magic pattern before JPEG. Consequence: This causes some JPEG files are detected as Minix filesystem. Fix: Order of JPEG and Minix magic patterns have been changed, because JPEG magic pattern is longer and therefore stronger. Result: File now tries to match JPEG magic pattern before Minix magic pattern, so it detects JPEG files properly.
Clone Of:
Environment:
Last Closed: 2012-02-21 05:46:40 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
2 JPEG image files - 1 normal and 1 that causes this issue (10.61 KB, application/x-gzip-compressed)
2011-11-29 19:25 UTC, Alan Staples
no flags Details
proposed patch (433 bytes, patch)
2011-11-30 08:27 UTC, Jan Kaluža
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2012:0201 0 normal SHIPPED_LIVE file bug fix update 2012-02-20 14:53:52 UTC

Description Alan Staples 2011-11-29 19:25:25 UTC
Created attachment 538200 [details]
2 JPEG image files - 1 normal and 1 that causes this issue

Description of problem:
The "file" utility incorrectly identifies a JPEG file as being of type "Minix filesystem"

Version-Release number of selected component (if applicable):
Red Hat Enterprise Linux 5 Update 5 64-bit
file-4.17-15.el5_3.1

How reproducible:
consistently, but only for some JPEG files

Steps to Reproduce:
1. extract the attached "jpeg_examples.tgz" file
2. copy extracted files to /tmp 
2. execute "file /tmp/funky.jpeg"
  
Actual results:
The utility outputs: "Minix filesystem, 30 char names"

Expected results:
The utility outputs: "JPEG image data, JFIF standard 1.01"

Additional info:
I've also included a "normal.jpeg" file within the attachment, which I have generated the same way as the attached "funky.jpeg", yet the file command works as expected on this JPEG.

Comment 2 Jan Kaluža 2011-11-30 08:27:06 UTC
Created attachment 538461 [details]
proposed patch

Check JPEG before minix FS since JPEG pattern is stronger

Comment 5 Alan Staples 2011-12-01 14:40:25 UTC
(In reply to comment #2)
> Created attachment 538461 [details]
> proposed patch
> 
> Check JPEG before minix FS since JPEG pattern is stronger

I tried "file -k" and indeed this does identify that the file is either a "Minix file system" or "JPEG image data, JFIF standard 1.01". I can parse the output of this command for "JPEG image data" systematically now. Thank you for your help.

Comment 10 Jan Kaluža 2012-01-05 11:37:44 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Cause: Minix magic pattern has the same beginning as the JPEG magic pattern and File tries to match Minix magic pattern before JPEG.

Consequence: This causes some JPEG files are detected as Minix filesystem.

Fix: Order of JPEG and Minix magic patterns have been changed, because JPEG magic pattern is longer and therefore stronger.

Result: File now tries to match JPEG magic pattern before Minix magic pattern, so it detects JPEG files properly.

Comment 11 errata-xmlrpc 2012-02-21 05:46:40 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2012-0201.html


Note You need to log in before you can comment on or make changes to this bug.