Skip to content

Commit 32502a5

Browse files
committed
PS: Fix compile errors and warnings.
1 parent 939b218 commit 32502a5

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

powershell/ql/lib/semmle/code/powershell/ExpandableStringExpression.qll

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ class ExpandableStringExpr extends @expandable_string_expression, Expr {
77

88
StringLiteral getUnexpandedValue() { expandable_string_expression(this, result, _, _) }
99

10-
private int getKind() { expandable_string_expression(this, _, result, _) }
11-
1210
int getNumExprs() { result = count(this.getAnExpr()) }
1311

1412
Expr getExpr(int i) { expandable_string_expression_nested_expression(this, i, result) }

powershell/ql/lib/semmle/code/powershell/controlflow/internal/Completion.qll

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,16 @@ abstract class Completion extends TCompletion {
9696
/** Holds if node `n` has the Boolean constant value `value`. */
9797
private predicate isBooleanConstant(Ast n, boolean value) {
9898
mustHaveBooleanCompletion(n) and
99-
none() // TODO
99+
// TODO
100+
exists(value) and
101+
none()
100102
}
101103

102104
private predicate isMatchingConstant(Ast n, boolean value) {
103105
inMatchingContext(n) and
104-
none() // TODO
106+
// TODO
107+
exists(value) and
108+
none()
105109
}
106110

107111
/**

powershell/ql/src/experimental/CommandInjection.ql

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ predicate constantBinaryExpression(BinaryExpr binary) {
2424
}
2525

2626
predicate onlyConstantExpressions(Expr expr){
27-
expr instanceof StringConstExpression or constantBinaryExpression(expr) or constantTernaryExpression(expr)
27+
expr instanceof StringConstExpr or constantBinaryExpression(expr) or constantTernaryExpression(expr)
2828
}
2929

3030
VarAccess getNonConstantVariableAssignment(VarAccess varexpr) {
@@ -39,7 +39,7 @@ VarAccess getNonConstantVariableAssignment(VarAccess varexpr) {
3939

4040
VarAccess getParameterWithVariableScope(VarAccess varexpr) {
4141
exists(Parameter parameter |
42-
result = parameter.getName() and
42+
result = parameter.getAnAccess() and
4343
containsScope(result, varexpr)
4444
)
4545
}
@@ -48,16 +48,16 @@ Expr getAllSubExpressions(Expr expr)
4848
{
4949
result = expr or
5050
result = getAllSubExpressions(expr.(ArrayLiteral).getAnElement()) or
51-
result = getAllSubExpressions(expr.(ArrayExpr).getStatementBlock().getAStatement().(Pipeline).getAComponent().(CmdExpr).getExpr())
51+
result = getAllSubExpressions(expr.(ArrayExpr).getStmtBlock().getAStmt().(Pipeline).getAComponent().(CmdExpr).getExpr())
5252
}
5353

5454
Expr dangerousCommandElement(Cmd command)
5555
{
5656
(
5757
command.getKind() = 28 or
58-
command.getName() = "Invoke-Expression"
58+
command.getCommandName() = "Invoke-Expression"
5959
) and
60-
result = getAllSubExpressions(command.getAnElement())
60+
result = getAllSubExpressions(command.getAnArgument())
6161
}
6262

6363
from Expr commandarg, VarAccess unknownDeclaration

0 commit comments

Comments
 (0)