public void push(IRegion region) { stack.push(curState); if (stack.size() > REGIONS_STACK_LIMIT) { throw new JadxOverflowException("Regions stack size limit reached"); } curState = curState.copy(); curState.region = region; if (DEBUG) { LOG.debug("Stack push: {}: {}", size(), curState); } }
public static void traverseIterative(MethodNode mth, IRegionIterativeVisitor visitor) { boolean repeat; int k = 0; do { repeat = traverseIterativeStepInternal(mth, visitor, mth.getRegion()); if (k++ > ITERATIVE_LIMIT) { throw new JadxOverflowException("Iterative traversal limit reached, method: " + mth); } } while (repeat); }
private synchronized <N extends IDexNode & IAttributeNode> String addError(N node, String error, @Nullable Throwable e) { errorNodes.add(node); errorsCount++; String msg = formatMsg(node, error); if (e == null) { LOG.error(msg); } else if (e instanceof JadxOverflowException) { // don't print full stack trace e = new JadxOverflowException(e.getMessage()); LOG.error("{}, details: {}", msg, e.getMessage()); } else { LOG.error(msg, e); } node.addAttr(AType.JADX_ERROR, new JadxError(error, e)); node.remove(AFlag.INCONSISTENT_CODE); return msg; }
private static void computeDominanceFrontier(MethodNode mth) { for (BlockNode exit : mth.getExitBlocks()) { exit.setDomFrontier(EMPTY); } for (BlockNode block : mth.getBasicBlocks()) { try { computeBlockDF(mth, block); } catch (StackOverflowError e) { throw new JadxOverflowException("Failed compute block dominance frontier"); } catch (Exception e) { throw new JadxRuntimeException("Failed compute block dominance frontier", e); } } }
public static void traverseIncludingExcHandlers(MethodNode mth, IRegionIterativeVisitor visitor) { boolean repeat; int k = 0; do { repeat = traverseIterativeStepInternal(mth, visitor, mth.getRegion()); if (!repeat) { for (ExceptionHandler h : mth.getExceptionHandlers()) { repeat = traverseIterativeStepInternal(mth, visitor, h.getHandlerRegion()); if (repeat) { break; } } } if (k++ > ITERATIVE_LIMIT) { throw new JadxOverflowException("Iterative traversal limit reached, method: " + mth); } } while (repeat); }