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

Fix: Making exit a terminal node in CFG #59

Merged
merged 6 commits into from
Aug 8, 2019
Merged

Fix: Making exit a terminal node in CFG #59

merged 6 commits into from
Aug 8, 2019

Conversation

silverfoxy
Copy link
Contributor

I added support for the issue mentioned here #57

Now calls to exit show up as Terminal_Exit node and the nodes after the exit are ignored in the CFG.

The CFG now looks like this, and Block # 2 no longer jumps to Block # 3.

$a = "index.php";
if (isset($a)) {
    include $a;
    exit;
}
echo "123";
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
    Terminal_Exit

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

@nikic
Copy link
Collaborator

nikic commented Aug 8, 2019

Looks like you accidentally committed your composer.phar file.

lib/PHPCfg/Parser.php Outdated Show resolved Hide resolved
lib/PHPCfg/Parser.php Outdated Show resolved Hide resolved
lib/PHPCfg/Parser.php Outdated Show resolved Hide resolved
@nikic nikic merged commit 4ee28d0 into ircmaxell:master Aug 8, 2019
@nikic
Copy link
Collaborator

nikic commented Aug 8, 2019

Thanks!

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

Successfully merging this pull request may close these issues.

2 participants