Skip to content

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

@silverfoxy

Description

@silverfoxy

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions