FreezeTool: Don't write blobinfo to wrong offset

The mechanism for searching for a specific symbol in a Mach-O binary got
tripped up when hitting the blobinfo stab entry, causing it to return an
offset of 0.
This commit is contained in:
Donny Lawrence 2020-04-24 18:05:16 -05:00 committed by rdb
parent f3c0fa06b3
commit 46ae5a52d3

View File

@ -2153,7 +2153,9 @@ class Freezer:
symoff += nlist_size
name = strings[strx : strings.find(b'\0', strx)]
if name == b'_' + symbol_name:
# If the entry's type has any bits at 0xe0 set, it's a debug
# symbol, and will point us to the wrong place.
if name == b'_' + symbol_name and type & 0xe0 == 0:
# Find out in which segment this is.
for vmaddr, vmsize, fileoff in segments:
# Is it defined in this segment?