Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Reflecting calls to exit in CFG (Next block after exit) #57

Closed
silverfoxy opened this issue Jul 17, 2019 · 1 comment
Closed

Reflecting calls to exit in CFG (Next block after exit) #57

silverfoxy opened this issue Jul 17, 2019 · 1 comment

Comments

@silverfoxy
Copy link
Contributor

If a code includes a call to exit function, the CFG does not reflect it.

  • PHP:
$a = "index.php";
if (isset($a)) {
    include $a;
    exit;
}
echo "123";
  • CFG:
Block#1
    Expr_Assign
        var: Var#1<$a>
        expr: LITERAL('index.php')
        result: Var#2
    Expr_Isset
        vars[0]: Var#1<$a>
        result: Var#3
    Stmt_JumpIf
        cond: Var#3
        if: Block#2
        else: Block#3

Block#2
    Parent: Block#1
    Expr_Include
        expr: Var#1<$a>
        result: Var#4
    Expr_Exit
        result: Var#5
    Stmt_Jump
        target: Block#3

Block#3
    Parent: Block#2
    Parent: Block#1
    Terminal_Echo
        expr: LITERAL('123')
    Terminal_Return

Block #2 should not jump to Block #3.

@ircmaxell
Copy link
Owner

Yeah, this is true. A Terminal_Exit style class should signify that there's an end to the application at that point.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants