Mixaill / FakePDB

Tool for PDB generation from IDA Pro database
Apache License 2.0
550 stars 61 forks source link

crash in GetPdbGuid #8

Closed Trass3r closed 4 years ago

Trass3r commented 4 years ago

Because DebugInfo is null. With this hack it runs but does not generate any pdb:

 src_pdbgen/pefile.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src_pdbgen/pefile.cpp b/src_pdbgen/pefile.cpp
index 80b1443..caedd2d 100644
--- a/src_pdbgen/pefile.cpp
+++ b/src_pdbgen/pefile.cpp
@@ -32,6 +32,10 @@ std::vector<uint8_t> PeFile::GetPdbGuid()
     llvm::StringRef PDBFileName;

     _obj->getDebugPDBInfo(DebugInfo, PDBFileName);
+    if (DebugInfo == nullptr)
+        return {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
     return std::vector<uint8_t>(&DebugInfo->PDB70.Signature[0], &DebugInfo->PDB70.Signature[16]);
 }
Mixaill commented 4 years ago

fixed in #9 / 9a0127bcd254600886e8726ee08855b6e13d938a

Trass3r commented 4 years ago

Still the question is why the code was written like that, assuming a pdb/exe debug section is already present.

Mixaill commented 4 years ago

Well, initially it was written to work with one specific binary, so, there is a much space for improvements to make this tool usable for general purposes.