From a9aab878a7a5747baa3c3db5178738684a9f867f Mon Sep 17 00:00:00 2001 From: psrok1 Date: Tue, 30 Jul 2024 18:36:55 +0200 Subject: [PATCH] Fix: pdbparse DBI - real number of references is in the sum of cRefCnt --- drakpdb/pdbparse/dbi.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drakpdb/pdbparse/dbi.py b/drakpdb/pdbparse/dbi.py index 7cc8040..4e88dce 100644 --- a/drakpdb/pdbparse/dbi.py +++ b/drakpdb/pdbparse/dbi.py @@ -150,7 +150,12 @@ def parse_stream(stream): fileIndex = sstFileIndex.parse_stream(stream) modStart = Array(fileIndex.cMod, Int16ul).parse_stream(stream) cRefCnt = Array(fileIndex.cMod, Int16ul).parse_stream(stream) - NameRef = Array(fileIndex.cRef, Int32ul).parse_stream(stream) + # In theory: cRef is supposed to contain the number of source files, but 16-bits + # is to short for having more than 64K source files. The real number of names is + # sum of cRefCnt + # Source: https://llvm.org/docs/PDB/DbiStream.html#file-info-substream + realcRef = sum(cRefCnt) + NameRef = Array(realcRef, Int32ul).parse_stream(stream) modules = [] # array of arrays of files files = [] # array of files (non unique) Names = stream.read(end - stream.tell())