Browse Source

Fix bug in ILStructure.FindAllBranches

pull/1198/head
Siegfried Pammer 7 years ago
parent
commit
42854c17c5
  1. 5
      ICSharpCode.Decompiler/Disassembler/ILStructure.cs

5
ICSharpCode.Decompiler/Disassembler/ILStructure.cs

@ -109,7 +109,7 @@ namespace ICSharpCode.Decompiler.Disassembler @@ -109,7 +109,7 @@ namespace ICSharpCode.Decompiler.Disassembler
int entryPoint = -1;
// entry point is first instruction in loop if prev inst isn't an unconditional branch
if (!isAfterConditionalBranch[loopStart])
if (loopStart > 0 && !isAfterConditionalBranch[loopStart])
entryPoint = allBranches[i].Target;
bool multipleEntryPoints = false;
@ -209,7 +209,7 @@ namespace ICSharpCode.Decompiler.Disassembler @@ -209,7 +209,7 @@ namespace ICSharpCode.Decompiler.Disassembler
(List<Branch> Branches, BitSet IsAfterUnconditionalBranch) FindAllBranches(BlobReader body)
{
var result = new List<Branch>();
var bitset = new BitSet(body.Length);
var bitset = new BitSet(body.Length + 1);
body.Reset();
int target;
while (body.RemainingBytes > 0) {
@ -231,6 +231,7 @@ namespace ICSharpCode.Decompiler.Disassembler @@ -231,6 +231,7 @@ namespace ICSharpCode.Decompiler.Disassembler
break;
default:
ILParser.SkipOperand(ref body, thisOpCode);
bitset[body.Offset] = IsUnconditionalBranch(thisOpCode);
break;
}
}

Loading…
Cancel
Save