forked from github/codeql
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #97 from microsoft/powershell-integrate-ssa-into-d…
…ataflow PS: Integrate SSA computations into dataflow
- Loading branch information
Showing
12 changed files
with
253 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import powershell | ||
|
||
abstract private class AbstractCall extends Ast { | ||
abstract Expr getCommand(); | ||
|
||
abstract Expr getArgument(int i); | ||
|
||
Expr getNamedArgument(string name) { none() } | ||
|
||
Expr getQualifier() { none() } | ||
} | ||
|
||
private class CmdCall extends AbstractCall instanceof Cmd { | ||
final override Expr getCommand() { result = Cmd.super.getCommand() } | ||
|
||
final override Expr getArgument(int i) { result = Cmd.super.getArgument(i) } | ||
|
||
final override Expr getNamedArgument(string name) { result = Cmd.super.getNamedArgument(name) } | ||
} | ||
|
||
private class InvokeMemberCall extends AbstractCall instanceof InvokeMemberExpr { | ||
final override Expr getCommand() { result = super.getMember() } | ||
|
||
final override Expr getArgument(int i) { result = InvokeMemberExpr.super.getArgument(i) } | ||
|
||
final override Expr getQualifier() { result = InvokeMemberExpr.super.getQualifier() } | ||
} | ||
|
||
final class Call = AbstractCall; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import powershell | ||
|
||
class ErrorExpr extends @error_expression, Expr { | ||
final override SourceLocation getLocation() { error_expression_location(this, result) } | ||
|
||
final override string toString() { result = "error" } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
$a1 = Source | ||
Sink $a1 | ||
|
||
$b = GetBool | ||
if($b) { | ||
$a2 = Source | ||
} | ||
Sink $a2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import powershell | ||
import semmle.code.powershell.dataflow.DataFlow | ||
|
||
from DataFlow::Node pred, DataFlow::Node succ | ||
where DataFlow::localFlowStep(pred, succ) | ||
select pred, succ |