Skip to content

Commit f68237d

Browse files
authored
Merge 37ddf58 into ba596ad
2 parents ba596ad + 37ddf58 commit f68237d

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

Confuser.Protections/ControlFlow/SwitchMangler.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,7 @@ public override void Mangle(CilBody body, ScopeBlock root, CFContext ctx) {
250250
hasUnknownSource = instrs => instrs.Any(instr => {
251251
if (trace.HasMultipleSources(instr.Offset))
252252
return true;
253-
List<Instruction> srcs;
254-
if (trace.BrRefs.TryGetValue(instr.Offset, out srcs)) {
253+
if (trace.BrRefs.TryGetValue(instr.Offset, out var srcs)) {
255254
// Target of switch => assume unknown
256255
if (srcs.Any(src => src.Operand is Instruction[]))
257256
return true;
@@ -261,6 +260,14 @@ public override void Mangle(CilBody body, ScopeBlock root, CFContext ctx) {
261260
src.Offset >= block.Instructions.Last().Offset))
262261
return true;
263262

263+
// Disable flow obfuscation for blocks reached by jump instructions.
264+
// Bug in #153 caused exactly this behaviour, expect for allowing wrong jump instructions
265+
// There is another issue present here tracked here:
266+
// https://github.com/mkaring/ConfuserEx/issues/162
267+
// Until this issue is resolved, the ctrl flow obfuscation will be severely reduced.
268+
if (srcs.Any())
269+
return true;
270+
264271
// Not targeted by the last of statements
265272
if (srcs.Any(src => !statementLast.Contains(src)))
266273
return true;

0 commit comments

Comments
 (0)