Skip to content

ARM: Attempt to subtract with overflow error when object has no symbol at address 0 #176

Closed
@LagoLunatic

Description

@LagoLunatic

nomappingsym.zip

This object has its first function start at offset 0x68, but at offset 0 has a .text symbol. It has no $a/$t/$d mapping symbol for this .text symbol since it's not a function.

$ readelf -s secure_area.o --wide

Symbol table '.symtab' contains 38 entries:
   Num:    Value  Size Type    Bind   Vis      Ndx Name
     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND 
     1: 00000000     0 NOTYPE  LOCAL  DEFAULT    1 .text
     2: 00000068     0 NOTYPE  LOCAL  DEFAULT    1 $t
     3: 000000d0     0 NOTYPE  LOCAL  DEFAULT    1 $t
     4: 0000013e     0 NOTYPE  LOCAL  DEFAULT    1 $t
     5: 000001ae     0 NOTYPE  LOCAL  DEFAULT    1 $t
     6: 00000220     0 NOTYPE  LOCAL  DEFAULT    1 $t
     7: 000002a0     0 NOTYPE  LOCAL  DEFAULT    1 $t
     8: 00000304     0 NOTYPE  LOCAL  DEFAULT    1 $t
     9: 00000368     0 NOTYPE  LOCAL  DEFAULT    1 $t
    10: 000003e4     0 NOTYPE  LOCAL  DEFAULT    1 $t
    11: 00000458     0 NOTYPE  LOCAL  DEFAULT    1 $t
    12: 000004ba     0 NOTYPE  LOCAL  DEFAULT    1 $t
    13: 00000520     0 NOTYPE  LOCAL  DEFAULT    1 $t
    14: 00000594     0 NOTYPE  LOCAL  DEFAULT    1 $t
    15: 000005f0     0 NOTYPE  LOCAL  DEFAULT    1 $t
    16: 00000660     0 NOTYPE  LOCAL  DEFAULT    1 $t
    17: 000006c8     0 NOTYPE  LOCAL  DEFAULT    1 $t
    18: 00000732     0 NOTYPE  LOCAL  DEFAULT    1 $t
    19: 000007a2     0 NOTYPE  LOCAL  DEFAULT    1 $t
    20: 00000068     4 FUNC    GLOBAL DEFAULT    1 RLUnCompReadNormalWrite8bit
    21: 000000d0     4 FUNC    GLOBAL DEFAULT    1 CpuSet
    22: 0000013e     4 FUNC    GLOBAL DEFAULT    1 Halt
    23: 000001ae     4 FUNC    GLOBAL DEFAULT    1 GetCRC16
    24: 00000220     4 FUNC    GLOBAL DEFAULT    1 BitUnPack
    25: 000002a0     4 FUNC    GLOBAL DEFAULT    1 CpuFastSet
    26: 00000304     4 FUNC    GLOBAL DEFAULT    1 VBlankIntrWait
    27: 00000368     4 FUNC    GLOBAL DEFAULT    1 LZ77UnCompReadByCallbackWrite16bit
    28: 000003e4     4 FUNC    GLOBAL DEFAULT    1 IntrWait
    29: 00000458     4 FUNC    GLOBAL DEFAULT    1 IsDebugger
    30: 000004ba     4 FUNC    GLOBAL DEFAULT    1 HuffUnCompReadByCallback
    31: 00000520     4 FUNC    GLOBAL DEFAULT    1 Sqrt
    32: 00000594     6 FUNC    GLOBAL DEFAULT    1 Mod
    33: 000005f0     4 FUNC    GLOBAL DEFAULT    1 LZ77UnCompReadNormalWrite8bit
    34: 00000660     4 FUNC    GLOBAL DEFAULT    1 SoftReset
    35: 000006c8     4 FUNC    GLOBAL DEFAULT    1 Div
    36: 00000732     4 FUNC    GLOBAL DEFAULT    1 WaitByLoop
    37: 000007a2     4 FUNC    GLOBAL DEFAULT    1 RLUnCompReadByCallbackWrite16bit

When trying to open this object, the following line:

.unwrap_or_else(|idx| idx - 1);

Produces this error on latest commit:
index out of bounds: the len is 18 but the index is 18446744073709551615

I'm not sure if this object is even valid (it was produced by dsd not mwcc, and mwld also crashes on it, so it might be a dsd issue?), but objdiff 2.7 could display the object without erroring out.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions