Don't treat System.Void as a value type

This commit is contained in:
de4dot 2012-11-14 19:28:46 +01:00
parent 45a11310de
commit 445b68f4f5
2 changed files with 7 additions and 2 deletions

View File

@ -229,7 +229,12 @@ namespace de4dot.blocks.cflow {
} }
protected static bool isValueType(IType type) { protected static bool isValueType(IType type) {
return type != null && type.IsValueType; if (type == null)
return false;
var ts = type as TypeSig;
if (ts == null)
return type.IsValueType;
return ts.IsValueType && ts.ElementType != ElementType.Void;
} }
} }
} }

View File

@ -236,7 +236,7 @@ namespace de4dot.code.deobfuscators.Babel_NET {
protected override bool isCompatibleType(int paramIndex, IType origType, IType newType) { protected override bool isCompatibleType(int paramIndex, IType origType, IType newType) {
if (new SigComparer().Equals(origType, newType)) if (new SigComparer().Equals(origType, newType))
return true; return true;
if (newType.IsValueType || origType.IsValueType) if (isValueType(newType) || isValueType(origType))
return false; return false;
return newType.FullName == "System.Object"; return newType.FullName == "System.Object";
} }