■ ■ ■ ■ ■ ■
jadx-core/src/main/java/jadx/core/dex/visitors/regions/RegionStack.java
| skipped 2 lines |
3 | 3 | | import jadx.core.dex.nodes.BlockNode; |
4 | 4 | | import jadx.core.dex.nodes.IRegion; |
5 | 5 | | import jadx.core.dex.nodes.MethodNode; |
| 6 | + | import jadx.core.utils.exceptions.JadxOverflowException; |
6 | 7 | | |
7 | 8 | | import java.util.ArrayDeque; |
8 | 9 | | import java.util.Collection; |
| skipped 7 lines |
16 | 17 | | final class RegionStack { |
17 | 18 | | private static final Logger LOG = LoggerFactory.getLogger(RegionStack.class); |
18 | 19 | | private static final boolean DEBUG = false; |
| 20 | + | |
| 21 | + | private static final int REGIONS_STACK_LIMIT = 1000; |
19 | 22 | | |
20 | 23 | | static { |
21 | 24 | | if (DEBUG) { |
| skipped 36 lines |
58 | 61 | | |
59 | 62 | | public void push(IRegion region) { |
60 | 63 | | stack.push(curState); |
61 | | - | if (stack.size() > 1000) { |
62 | | - | throw new StackOverflowError("Deep code hierarchy"); |
| 64 | + | if (stack.size() > REGIONS_STACK_LIMIT) { |
| 65 | + | throw new JadxOverflowException("Regions stack size limit reached"); |
63 | 66 | | } |
64 | 67 | | curState = curState.copy(); |
65 | 68 | | curState.region = region; |
| skipped 47 lines |