bug-binutils
[Top][All Lists]
Advanced

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

[Bug binutils/12639] New: readelf failed detect corrupted symtab


From: hjl.tools at gmail dot com
Subject: [Bug binutils/12639] New: readelf failed detect corrupted symtab
Date: Tue, 5 Apr 2011 16:18:38 +0000

http://sourceware.org/bugzilla/show_bug.cgi?id=12639

           Summary: readelf failed detect corrupted symtab
           Product: binutils
           Version: 2.22 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: binutils
        AssignedTo: address@hidden
        ReportedBy: address@hidden


Created attachment 5646
  --> http://sourceware.org/bugzilla/attachment.cgi?id=5646
A testcase with bad symtab

address@hidden cq167859]$ readelf -sS --wide  tr70098.bad.o      
There are 13 section headers, starting at offset 0x3008:

Section Headers:
  [Nr] Name              Type            Address          Off    Size   ES Flg
Lk Inf Al
  [ 0]                   NULL            0000000000000000 000000 000000 00     
0   0  0
  [ 1] .symtab           SYMTAB          0000000000000000 000040 000420 18     
9  37  4
  [ 2] .rodata           PROGBITS        0000000000000000 000460 000240 00   A 
0   0 32
  [ 3] .data             PROGBITS        0000000000000000 0006a0 000c28 00  WA 
0   0  8
  [ 4] .rodata.str1.4    PROGBITS        0000000000000000 0012c8 000008 01 AMS 
0   0  4
  [ 5] .text             PROGBITS        0000000000000000 0012d0 000c00 00  AX 
0   0 16
  [ 6] .note.GNU-stack   NOTE            0000000000000000 001ed0 000000 00     
0   0  1
  [ 7] .comment          PROGBITS        0000000000000000 001ed0 000013 00     
0   0  1
  [ 8] .eh_frame         PROGBITS        0000000000000000 001ee3 000238 00   A 
0   0  4
  [ 9] .strtab           STRTAB          0000000000000000 00211b 000348 00     
0   0  1
  [10] .rela.data        RELA            0000000000000000 002463 0001b0 18     
1   3  8
  [11] .rela.text        RELA            0000000000000000 002613 0009a8 18     
1   5  8
  [12] .rela.eh_frame    RELA            0000000000000000 002fbb 000048 18     
1   8  8
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings), l (large)
  I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
  O (extra OS processing required) o (OS specific), p (processor specific)

Symbol table '.symtab' contains 44 entries:
   Num:    Value          Size Type    Bind   Vis      Ndx Name
     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND 
     1: 0000000000000000     0 FILE    LOCAL  DEFAULT  ABS tr70098.c
     2: 0000000000000000     0 SECTION LOCAL  DEFAULT    9 .strtab
     3: 0000000000000000     0 SECTION LOCAL  DEFAULT    1 .symtab
     4: 0000000000000000     0 SECTION LOCAL  DEFAULT    2 .rodata
     5: 0000000000000000     0 SECTION LOCAL  DEFAULT    3 .data
     6: 0000000000000000     0 SECTION LOCAL  DEFAULT    4 .rodata.str1.4
     7: 0000000000000000     8 OBJECT  LOCAL  DEFAULT    4 .L_2__STRING.0
     8: 0000000000000000     0 SECTION LOCAL  DEFAULT    5 .text
     9: 0000000000000000    20 OBJECT  LOCAL  DEFAULT    3
__pgo_segment_2pack.7.0.3
    10: 0000000000000018    52 OBJECT  LOCAL  DEFAULT    3
__pgo_segment_2pack.8.0.3
    11: 0000000000000050   848 OBJECT  LOCAL  DEFAULT    3
__pgo_segment_2pack.6.0.3
    12: 0000000000000000    73 OBJECT  LOCAL  DEFAULT    2
__pgopti_2inst_string.8.0.3
    13: 000000000000004c    83 OBJECT  LOCAL  DEFAULT    2
__pgopti_2inst_string.9.0.3
    14: 00000000000000a0     5 OBJECT  LOCAL  DEFAULT    2
__pgopti_2inst_string.10.0.3
    15: 00000000000000a8     5 OBJECT  LOCAL  DEFAULT    2
__pgopti_2inst_string.11.0.3
    16: 00000000000003a0    20 OBJECT  LOCAL  DEFAULT    3
__pgo_segment_2pack.1.0.1
    17: 00000000000003b8    80 OBJECT  LOCAL  DEFAULT    3
__pgo_segment_2pack.2.0.1
    18: 0000000000000408  1552 OBJECT  LOCAL  DEFAULT    3
__pgo_segment_2pack.0.0.1
    19: 00000000000000c0    73 OBJECT  LOCAL  DEFAULT    2
__pgopti_2inst_string.0.0.1
    20: 000000000000010c    83 OBJECT  LOCAL  DEFAULT    2
__pgopti_2inst_string.1.0.1
    21: 0000000000000160     5 OBJECT  LOCAL  DEFAULT    2
__pgopti_2inst_string.2.0.1
    22: 0000000000000168     4 OBJECT  LOCAL  DEFAULT    2
__pgopti_2inst_string.3.0.1
    23: 0000000000000a18    20 OBJECT  LOCAL  DEFAULT    3
__pgo_segment_2pack.4.0.2
    24: 0000000000000a30    36 OBJECT  LOCAL  DEFAULT    3
__pgo_segment_2pack.5.0.2
    25: 0000000000000a58   464 OBJECT  LOCAL  DEFAULT    3
__pgo_segment_2pack.3.0.2
    26: 0000000000000180    73 OBJECT  LOCAL  DEFAULT    2
__pgopti_2inst_string.4.0.2
    27: 00000000000001cc    83 OBJECT  LOCAL  DEFAULT    2
__pgopti_2inst_string.5.0.2
    28: 0000000000000220     5 OBJECT  LOCAL  DEFAULT    2
__pgopti_2inst_string.6.0.2
    29: 0000000000000228     5 OBJECT  LOCAL  DEFAULT    2
__pgopti_2inst_string.7.0.2
    30: 0000000000000000     0 SECTION LOCAL  DEFAULT    6 .note.GNU-stack
    31: 0000000000000000     0 SECTION LOCAL  DEFAULT    7 .comment
    32: 0000000000000000     0 SECTION LOCAL  DEFAULT    8 .eh_frame
    33: 0000000000000000     0 SECTION LOCAL  DEFAULT   10 .rela.data
    34: 0000000000000000     0 SECTION LOCAL  DEFAULT   11 .rela.text
    35: 0000000000000000     0 SECTION LOCAL  DEFAULT   12 .rela.eh_frame
    36: 0000000000000000  1392 FUNC    GLOBAL DEFAULT    5 main
...

The sh_info field of symtab section header should be 36, not 37.
But readelf doesn't detect it.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



reply via email to

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