Search in sources :

Example 1 with JadxOverflowException

use of jadx.core.utils.exceptions.JadxOverflowException in project jadx by skylot.

the class RegionMaker method makeRegion.

public Region makeRegion(BlockNode startBlock, RegionStack stack) {
    if (Consts.DEBUG) {
        int id = startBlock.getId();
        if (processedBlocks.get(id)) {
            LOG.debug(" Block already processed: {}, mth: {}", startBlock, mth);
        } else {
            processedBlocks.set(id);
        }
    }
    regionsCount++;
    if (regionsCount > REGIONS_LIMIT) {
        throw new JadxOverflowException("Regions count limit reached");
    }
    Region r = new Region(stack.peekRegion());
    BlockNode next = startBlock;
    while (next != null) {
        next = traverse(r, next, stack);
    }
    return r;
}
Also used : BlockNode(jadx.core.dex.nodes.BlockNode) JadxOverflowException(jadx.core.utils.exceptions.JadxOverflowException) Region(jadx.core.dex.regions.Region) IRegion(jadx.core.dex.nodes.IRegion) SwitchRegion(jadx.core.dex.regions.SwitchRegion) SynchronizedRegion(jadx.core.dex.regions.SynchronizedRegion) LoopRegion(jadx.core.dex.regions.loops.LoopRegion) IfRegion(jadx.core.dex.regions.conditions.IfRegion)

Example 2 with JadxOverflowException

use of jadx.core.utils.exceptions.JadxOverflowException in project jadx by skylot.

the class ErrorsCounter method addError.

private void addError(IAttributeNode node, String msg, Throwable e) {
    errorNodes.add(node);
    errorsCount++;
    if (e != null) {
        if (e.getClass() == JadxOverflowException.class) {
            // don't print full stack trace
            e = new JadxOverflowException(e.getMessage());
            LOG.error("{}, message: {}", msg, e.getMessage());
        } else {
            LOG.error(msg, e);
        }
        node.addAttr(new JadxErrorAttr(e));
    } else {
        node.add(AFlag.INCONSISTENT_CODE);
        LOG.error(msg);
    }
}
Also used : JadxOverflowException(jadx.core.utils.exceptions.JadxOverflowException) JadxErrorAttr(jadx.core.dex.attributes.nodes.JadxErrorAttr)

Example 3 with JadxOverflowException

use of jadx.core.utils.exceptions.JadxOverflowException in project jadx by skylot.

the class DepthRegionTraversal method traverseIncludingExcHandlers.

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);
}
Also used : ExceptionHandler(jadx.core.dex.trycatch.ExceptionHandler) JadxOverflowException(jadx.core.utils.exceptions.JadxOverflowException)

Aggregations

JadxOverflowException (jadx.core.utils.exceptions.JadxOverflowException)3 JadxErrorAttr (jadx.core.dex.attributes.nodes.JadxErrorAttr)1 BlockNode (jadx.core.dex.nodes.BlockNode)1 IRegion (jadx.core.dex.nodes.IRegion)1 Region (jadx.core.dex.regions.Region)1 SwitchRegion (jadx.core.dex.regions.SwitchRegion)1 SynchronizedRegion (jadx.core.dex.regions.SynchronizedRegion)1 IfRegion (jadx.core.dex.regions.conditions.IfRegion)1 LoopRegion (jadx.core.dex.regions.loops.LoopRegion)1 ExceptionHandler (jadx.core.dex.trycatch.ExceptionHandler)1