From 46ae5a52d3add3691050021397babb929e2c7fdd Mon Sep 17 00:00:00 2001 From: Donny Lawrence Date: Fri, 24 Apr 2020 18:05:16 -0500 Subject: [PATCH] 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. --- direct/src/dist/FreezeTool.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/direct/src/dist/FreezeTool.py b/direct/src/dist/FreezeTool.py index f448913bd9..397736c203 100644 --- a/direct/src/dist/FreezeTool.py +++ b/direct/src/dist/FreezeTool.py @@ -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?