Skip to content

Commit

Permalink
fix: lower regions count limit (#354)
Browse files Browse the repository at this point in the history
  • Loading branch information
skylot committed Sep 8, 2018
1 parent f6f883b commit 9be62fb
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,16 @@
public class RegionMaker {
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 int regionsLimit;
private int regionsCount;
private BitSet processedBlocks;

public RegionMaker(MethodNode 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) {
Expand All @@ -84,7 +84,7 @@ public Region makeRegion(BlockNode startBlock, RegionStack stack) {
while (next != null) {
next = traverse(r, next, stack);
regionsCount++;
if (regionsCount > REGIONS_LIMIT) {
if (regionsCount > regionsLimit) {
throw new JadxRuntimeException("Regions count limit reached");
}
}
Expand Down

0 comments on commit 9be62fb

Please sign in to comment.