Bug 109509 - File produces errors on ELF files with no section header
File produces errors on ELF files with no section header
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: file (Show other bugs)
9
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Radek Vokal
Mike McLean
http://www.darkspiral.net/natasha/fil...
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2003-11-08 16:11 EST by Seth Randall
Modified: 2007-04-18 12:59 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-09-15 03:54:56 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Check variable num and return if it's zero (748 bytes, patch)
2003-11-08 16:13 EST, Seth Randall
no flags Details | Diff

  None (edit)
Description Seth Randall 2003-11-08 16:11:20 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031018

Description of problem:
When running file on a ELF format file with no section header, file
produces a bogus warning. A sample session:

$ file epsxe
epsxe: ELF 32-bit LSB executable, Intel 80386, version 1 (Linux),
statically linkedfile: corrupted section header size.

The code responsible for the corrupted section header size. is added
by the file-3.39-cksize.patch patch. In the functions doshn,
dophn_exec, and dophn_core, the following checks are made:

doshn:

        if (size != sh_size)
            error("corrupted section header size.\n");
    

dophn_exec:
dophn_core:

        if (size != ph_size)
            error("corrupted program header size.\n");
    

sh_size and ph_size are the sizes of the ELF headers and size is the
size of the header being looked up.

But, size can be zero if there is no section or program header. If a
program has now section header, a incorrect error is returned. See ELF
Header

A simple fix is to check if num or size are zero and return if they are.

A patch is attached to fix the problem.

Version-Release number of selected component (if applicable):
file-3.39-9

How reproducible:
Always

Steps to Reproduce:
1. Run upx on a ELF executable
2. Run file on the resulting file
3.
    

Actual Results:  I got a line saying
epsxe: ELF 32-bit LSB executable, Intel 80386, version 1 (Linux),
statically linkedfile: corrupted section header size.

Expected Results:  It should only say
epsxe: ELF 32-bit LSB executable, Intel 80386, version 1 (Linux),
statically linked

Additional info:

If file doesn't like the executable, then its use in brp-strip
prevents the creation of RPMS
Comment 1 Seth Randall 2003-11-08 16:13:15 EST
Created attachment 95833 [details]
Check variable num and return if it's zero
Comment 2 Radek Vokal 2004-09-15 03:54:56 EDT
Fixed in file-4.10-1. File reports "no section header"

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