Settings中的array参数加上检查
parent
8314ed4327
commit
b1731a8c38
|
@ -39,6 +39,7 @@ namespace Obfuz.Emit
|
|||
private readonly MethodDef _method;
|
||||
private readonly BasicBlockCollection _basicBlocks;
|
||||
private readonly Dictionary<Instruction, InstructionParameterInfo> _instructionParameterInfos = new Dictionary<Instruction, InstructionParameterInfo>();
|
||||
private readonly Dictionary<Instruction, EvalDataType> _evalStackTopDataTypeAfterInstructions = new Dictionary<Instruction, EvalDataType>();
|
||||
|
||||
public EvalStackCalculator(MethodDef method)
|
||||
{
|
||||
|
@ -53,6 +54,11 @@ namespace Obfuz.Emit
|
|||
return _instructionParameterInfos.TryGetValue(inst, out info);
|
||||
}
|
||||
|
||||
public bool TryGetPushResult(Instruction inst, out EvalDataType result)
|
||||
{
|
||||
return _evalStackTopDataTypeAfterInstructions.TryGetValue(inst, out result);
|
||||
}
|
||||
|
||||
class EvalStackState
|
||||
{
|
||||
public bool visited;
|
||||
|
@ -861,6 +867,10 @@ namespace Obfuz.Emit
|
|||
stackDatas.AddRange(newPushedDatas);
|
||||
Assert.AreEqual(stackSize + pushed - pops, stackDatas.Count);
|
||||
}
|
||||
if (pushed > 0 && stackDatas.Count > 0)
|
||||
{
|
||||
_evalStackTopDataTypeAfterInstructions[inst] = stackDatas.Last();
|
||||
}
|
||||
}
|
||||
foreach (BasicBlock outBb in block.outBlocks)
|
||||
{
|
||||
|
|
|
@ -160,7 +160,7 @@ namespace Obfuz
|
|||
obfuscatedAssemblyOutputPath = settings.GetObfuscatedAssemblyOutputPath(target),
|
||||
obfuscatedAssemblyTempOutputPath = settings.GetObfuscatedAssemblyTempOutputPath(target),
|
||||
enabledObfuscationPasses = settings.obfuscationPassSettings.enabledPasses,
|
||||
obfuscationPassRuleConfigFiles = settings.obfuscationPassSettings.ruleFiles.ToList(),
|
||||
obfuscationPassRuleConfigFiles = settings.obfuscationPassSettings.ruleFiles?.ToList() ?? new List<string>(),
|
||||
obfuscationPasses = new List<IObfuscationPass>(),
|
||||
},
|
||||
};
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace Obfuz.Settings
|
|||
|
||||
public List<string> GetAssembliesToObfuscate()
|
||||
{
|
||||
var asses = new List<string>(assembliesToObfuscate);
|
||||
var asses = new List<string>(assembliesToObfuscate ?? Array.Empty<string>());
|
||||
if (obfuscateObfuzRuntime && !asses.Contains(ConstValues.ObfuzRuntimeAssemblyName))
|
||||
{
|
||||
asses.Add(ConstValues.ObfuzRuntimeAssemblyName);
|
||||
|
@ -34,7 +34,7 @@ namespace Obfuz.Settings
|
|||
public List<string> GetObfuscationRelativeAssemblyNames()
|
||||
{
|
||||
var asses = GetAssembliesToObfuscate();
|
||||
asses.AddRange(nonObfuscatedButReferencingObfuscatedAssemblies);
|
||||
asses.AddRange(nonObfuscatedButReferencingObfuscatedAssemblies ?? Array.Empty<string>());
|
||||
return asses;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace Obfuz.Settings
|
|||
{
|
||||
return new CallObfuscationSettingsFacade
|
||||
{
|
||||
ruleFiles = ruleFiles.ToList(),
|
||||
ruleFiles = ruleFiles?.ToList() ?? new List<string>(),
|
||||
obfuscationLevel = obfuscationLevel,
|
||||
maxProxyMethodCountPerDispatchMethod = maxProxyMethodCountPerDispatchMethod,
|
||||
};
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace Obfuz.Settings
|
|||
{
|
||||
return new ConstEncryptionSettingsFacade
|
||||
{
|
||||
ruleFiles = ruleFiles.ToList(),
|
||||
ruleFiles = ruleFiles?.ToList() ?? new List<string>(),
|
||||
encryptionLevel = encryptionLevel,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace Obfuz.Settings
|
|||
{
|
||||
return new ExprObfuscationSettingsFacade
|
||||
{
|
||||
ruleFiles = new List<string>(ruleFiles),
|
||||
ruleFiles = new List<string>(ruleFiles ?? Array.Empty<string>()),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace Obfuz.Settings
|
|||
{
|
||||
return new FieldEncryptionSettingsFacade
|
||||
{
|
||||
ruleFiles = ruleFiles.ToList(),
|
||||
ruleFiles = ruleFiles?.ToList() ?? new List<string>(),
|
||||
encryptionLevel = encryptionLevel,
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue