Skip to content

Commit

Permalink
Add updated submodule
Browse files Browse the repository at this point in the history
  • Loading branch information
wtfsck committed Mar 30, 2018
1 parent d81e8d1 commit a246ca9
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
6 changes: 5 additions & 1 deletion de4dot.blocks/Instr.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ public object Operand {

// Returns the variable or null if it's not a ldloc/stloc instruction. It does not return
// a local variable if it's a ldloca/ldloca.s instruction.
public static Local GetLocalVar(IList<Local> locals, Instr instr) => instr.Instruction.GetLocal(locals);
public static Local GetLocalVar(IList<Local> locals, Instr instr) {
if (instr.Instruction.IsLdloc() || instr.Instruction.IsStloc())
return instr.Instruction.GetLocal(locals);
return null;
}

static public bool IsFallThrough(OpCode opCode) {
switch (opCode.FlowControl) {
Expand Down
11 changes: 2 additions & 9 deletions de4dot.code/deobfuscators/Babel_NET/ImageReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -447,15 +447,8 @@ TypeSig ReadArrayType() {

ByRefSig ReadByRefType() => new ByRefSig(ReadTypeSig());

public uint ReadVariableLengthUInt32() {
reader.ReadCompressedUInt32(out uint val);
return val;
}

public int ReadVariableLengthInt32() {
reader.ReadCompressedUInt32(out uint val);
return (int)val;
}
public uint ReadVariableLengthUInt32() => reader.ReadCompressedUInt32();
public int ReadVariableLengthInt32() => (int)reader.ReadCompressedUInt32();

int GetMetadataOffset() {
reader.Position = reader.Length - 4;
Expand Down
6 changes: 6 additions & 0 deletions de4dot.code/deobfuscators/ConstantsReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,8 @@ protected virtual bool GetLocalConstantInt32(Instruction instr, out int value) {
value = 0;
if (locals == null)
return false;
if (!instr.IsLdloc() && !instr.IsStloc())
return false;
var local = instr.GetLocal(locals);
if (local == null)
return false;
Expand All @@ -661,6 +663,8 @@ protected virtual bool GetLocalConstantInt64(Instruction instr, out long value)
value = 0;
if (locals == null)
return false;
if (!instr.IsLdloc() && !instr.IsStloc())
return false;
var local = instr.GetLocal(locals);
if (local == null)
return false;
Expand All @@ -678,6 +682,8 @@ protected virtual bool GetLocalConstantDouble(Instruction instr, out double valu
value = 0;
if (locals == null)
return false;
if (!instr.IsLdloc() && !instr.IsStloc())
return false;
var local = instr.GetLocal(locals);
if (local == null)
return false;
Expand Down

0 comments on commit a246ca9

Please sign in to comment.