Throw InvalidMethodBody if IOException

This commit is contained in:
de4dot 2012-04-25 18:06:27 +02:00
parent 903db59827
commit bff017a317

View File

@ -84,7 +84,7 @@ namespace de4dot.code.deobfuscators {
code = reader.ReadBytes((int)mbHeader.codeSize); code = reader.ReadBytes((int)mbHeader.codeSize);
if ((mbHeader.flags & 8) != 0) if ((mbHeader.flags & 8) != 0)
extraSections = readExtraSections(reader); extraSections = readExtraSections2(reader);
else else
extraSections = null; extraSections = null;
@ -96,6 +96,15 @@ namespace de4dot.code.deobfuscators {
} }
public static byte[] readExtraSections(BinaryReader reader) { public static byte[] readExtraSections(BinaryReader reader) {
try {
return readExtraSections2(reader);
}
catch (IOException) {
throw new InvalidMethodBody();
}
}
static byte[] readExtraSections2(BinaryReader reader) {
align(reader, 4); align(reader, 4);
int startPos = (int)reader.BaseStream.Position; int startPos = (int)reader.BaseStream.Position;
parseSection(reader); parseSection(reader);