Make sure rvas list is never null

This commit is contained in:
de4dot 2012-02-08 16:14:07 +01:00
parent 780da4a0ad
commit 1583552825

View File

@ -30,7 +30,7 @@ namespace de4dot.code.deobfuscators.CodeVeil {
TypeDefinition theType; TypeDefinition theType;
MethodDefinition initMethod; MethodDefinition initMethod;
ObfuscatorVersion obfuscatorVersion = ObfuscatorVersion.Unknown; ObfuscatorVersion obfuscatorVersion = ObfuscatorVersion.Unknown;
List<int> rvas; // _stub and _executive List<int> rvas = new List<int>(); // _stub and _executive
public bool Detected { public bool Detected {
get { return theType != null; } get { return theType != null; }
@ -143,11 +143,12 @@ namespace de4dot.code.deobfuscators.CodeVeil {
} }
bool checkMethodsType(TypeDefinition type) { bool checkMethodsType(TypeDefinition type) {
rvas = new List<int>();
var fields = getRvaFields(type); var fields = getRvaFields(type);
if (fields.Count < 2) // RVAs for executive and stub are always present if encrypted methods if (fields.Count < 2) // RVAs for executive and stub are always present if encrypted methods
return true; return true;
rvas = new List<int>(fields.Count);
foreach (var field in fields) foreach (var field in fields)
rvas.Add(field.RVA); rvas.Add(field.RVA);
return true; return true;