提交 9be62fb1 编写于 作者: S Skylot

fix: lower regions count limit (#354)

上级 f6f883b9
...@@ -55,16 +55,16 @@ import static jadx.core.utils.BlockUtils.skipSyntheticSuccessor; ...@@ -55,16 +55,16 @@ import static jadx.core.utils.BlockUtils.skipSyntheticSuccessor;
public class RegionMaker { public class RegionMaker {
private static final Logger LOG = LoggerFactory.getLogger(RegionMaker.class); private static final Logger LOG = LoggerFactory.getLogger(RegionMaker.class);
// 'dumb' guard to prevent endless loop in regions processing
private static final int REGIONS_LIMIT = 1000 * 1000;
private final MethodNode mth; private final MethodNode mth;
private final int regionsLimit;
private int regionsCount; private int regionsCount;
private BitSet processedBlocks; private BitSet processedBlocks;
public RegionMaker(MethodNode mth) { public RegionMaker(MethodNode mth) {
this.mth = mth; this.mth = mth;
this.processedBlocks = new BitSet(mth.getBasicBlocks().size()); int blocksCount = mth.getBasicBlocks().size();
this.processedBlocks = new BitSet(blocksCount);
this.regionsLimit = blocksCount * 100;
} }
public Region makeRegion(BlockNode startBlock, RegionStack stack) { public Region makeRegion(BlockNode startBlock, RegionStack stack) {
...@@ -84,7 +84,7 @@ public class RegionMaker { ...@@ -84,7 +84,7 @@ public class RegionMaker {
while (next != null) { while (next != null) {
next = traverse(r, next, stack); next = traverse(r, next, stack);
regionsCount++; regionsCount++;
if (regionsCount > REGIONS_LIMIT) { if (regionsCount > regionsLimit) {
throw new JadxRuntimeException("Regions count limit reached"); throw new JadxRuntimeException("Regions count limit reached");
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册