Skip to content

R2RDump fixes #32460

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ private void ParseUnwindCode(ref int i)
code.NextFrameOffset = (int)offset * 16;
if ((UnwindCodeArray[i].FrameOffset & 0xF0000000) != 0)
{
Console.WriteLine("Warning: Illegal unwindInfo unscaled offset: too large");
throw new BadImageFormatException("Warning: Illegal unwindInfo unscaled offset: too large");
}
}
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public void ParseCoreHeader(byte[] image, ref int curOffset)
var sectionType = (ReadyToRunSectionType)type;
if (!Enum.IsDefined(typeof(ReadyToRunSectionType), type))
{
Console.WriteLine("Warning: Invalid ReadyToRun section type");
throw new BadImageFormatException("Warning: Invalid ReadyToRun section type");
}
int sectionStartRva = NativeReader.ReadInt32(image, ref curOffset);
int sectionLength = NativeReader.ReadInt32(image, ref curOffset);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,17 @@ private bool TryLocateNativeReadyToRunHeader()
return false;
}

private MetadataReader GetSystemModuleMetadataReader() =>
_systemModuleReader ??= _assemblyResolver.FindAssembly(SystemModuleName, Filename);
private MetadataReader GetSystemModuleMetadataReader()
{
if (_systemModuleReader == null)
{
if (_assemblyResolver != null)
{
_systemModuleReader = _assemblyResolver.FindAssembly(SystemModuleName, Filename);
}
}
return _systemModuleReader;
}

public MetadataReader GetGlobalMetadataReader()
{
Expand Down Expand Up @@ -630,7 +639,7 @@ private void ParseInstanceMethodEntrypoints(bool[] isEntryPoint)
if (_composite)
{
// The only types that don't have module overrides on them in composite images are primitive types within the system module
mdReader ??= GetSystemModuleMetadataReader();
mdReader = GetSystemModuleMetadataReader();
}
owningType = decoder.ReadTypeSignatureNoEmit();
}
Expand Down