Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Validate the PDB type. This fixes icsharpcode#723.
This duplicates the logic from jbevain/cecil#279
  • Loading branch information
AustinWise committed Jul 22, 2016
1 parent e2e952a commit 57c4495
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions ILSpy/LoadedAssembly.cs
Expand Up @@ -139,6 +139,20 @@ ModuleDefinition LoadAssembly(object state)

private void LoadSymbols(ModuleDefinition module)
{
if (!module.HasDebugHeader) {
return;
}
byte[] headerBytes;
var debugHeader = module.GetDebugHeader(out headerBytes);
if (debugHeader.Type != 2) {
// the debug type is not IMAGE_DEBUG_TYPE_CODEVIEW
return;
}
if (debugHeader.MajorVersion != 0 || debugHeader.MinorVersion != 0) {
// the PDB type is not compatible with PdbReaderProvider. It is probably a Portable PDB
return;
}

// search for pdb in same directory as dll
string pdbName = Path.Combine(Path.GetDirectoryName(fileName), Path.GetFileNameWithoutExtension(fileName) + ".pdb");
if (File.Exists(pdbName)) {
Expand Down

0 comments on commit 57c4495

Please sign in to comment.