Skip to content

fix: add more checks to better find handler's end#2749

Merged
skylot merged 1 commit intoskylot:masterfrom
ewt45:inline-out-of-try3
Jan 19, 2026
Merged

fix: add more checks to better find handler's end#2749
skylot merged 1 commit intoskylot:masterfrom
ewt45:inline-out-of-try3

Conversation

@ewt45
Copy link
Copy Markdown
Contributor

@ewt45 ewt45 commented Jan 19, 2026

This pr add a method BlockUtils.getTryAndHandlerCrossBlock(). It traverse domFrontier start from handler block, find the first frontier whose predecessor is try end.

This method is used in

  • IfRegionMaker. If the IfRegion is inside try blocks, then its branches must end if they reach try end. In This case, next block of try end, which is the cross of try and handler, will be the if's outBlock. A Test (TestIfInTryCatch) is added.
  • ExcHandlersRegionMaker, to try to find proper handler end.
    • Related issue [core] IfRegionMaker find the wrong outBlock #2384.
    • A mininal reproducible example Test (TestTryCatchInIf2) is added.
    • cfg 1
    • in the smali, part of the handler region and else region use a same block (B:7:0x0017). When finding handler region's end, handler's domFrontier (B:7:0x0017) is in the half of handler region, instead of the end. This pr uses BlockUtils.getTryAndHandlerCrossBlock() to go further to find the real end (B:8:0x0018).

Copy link
Copy Markdown
Owner

@skylot skylot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great fix. Thank you 👍

@skylot skylot merged commit 220a219 into skylot:master Jan 19, 2026
3 of 4 checks passed
@ewt45 ewt45 deleted the inline-out-of-try3 branch January 20, 2026 07:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants