Skip to content

Commit d87d015

Browse files
committed
C#: Use the operation classes where applicable.
1 parent 7890eb5 commit d87d015

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

csharp/ql/lib/experimental/code/csharp/Cryptography/NonCryptographicHashes.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ private predicate maybeUsedInElfHashFunction(Variable v, Operation xor, Operatio
4848
Expr e1, Expr e2, AssignExpr addAssign, AssignExpr xorAssign, Operation notOp,
4949
AssignExpr notAssign
5050
|
51-
(add instanceof AddExpr or add instanceof AssignAddExpr) and
51+
add instanceof AddOperation and
5252
e1.getAChild*() = add.getAnOperand() and
5353
e1 instanceof BinaryBitwiseOperation and
5454
e2 = e1.(BinaryBitwiseOperation).getLeftOperand() and

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ private class TriedControlFlowElement extends ControlFlowElement {
344344
result instanceof SystemOutOfMemoryExceptionClass
345345
or
346346
this =
347-
any(AddExpr ae |
347+
any(AddOperation ae |
348348
ae.getType() instanceof StringType and
349349
result instanceof SystemOutOfMemoryExceptionClass
350350
or
@@ -353,24 +353,24 @@ private class TriedControlFlowElement extends ControlFlowElement {
353353
)
354354
or
355355
this =
356-
any(SubExpr se |
356+
any(SubOperation se |
357357
se.getType() instanceof IntegralType and
358358
result instanceof SystemOverflowExceptionClass
359359
)
360360
or
361361
this =
362-
any(MulExpr me |
362+
any(MulOperation me |
363363
me.getType() instanceof IntegralType and
364364
result instanceof SystemOverflowExceptionClass
365365
)
366366
or
367367
this =
368-
any(DivExpr de |
368+
any(DivOperation de |
369369
not de.getDenominator().getValue().toFloat() != 0 and
370370
result instanceof SystemDivideByZeroExceptionClass
371371
)
372372
or
373-
this instanceof RemExpr and
373+
this instanceof RemOperation and
374374
result instanceof SystemDivideByZeroExceptionClass
375375
or
376376
this instanceof DynamicExpr and

csharp/ql/src/Security Features/CWE-119/LocalUnvalidatedArithmetic.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import csharp
1919
import semmle.code.csharp.controlflow.Guards
2020

21-
from AddExpr add, VirtualMethodCall taintSrc
21+
from AddOperation add, VirtualMethodCall taintSrc
2222
where
2323
// `add` is performing pointer arithmetic
2424
add.getType() instanceof PointerType and

csharp/ql/src/experimental/CWE-918/RequestForgery.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ module RequestForgery {
211211
}
212212

213213
private predicate stringConcatStep(DataFlow::Node prev, DataFlow::Node succ) {
214-
exists(AddExpr a |
214+
exists(AddOperation a |
215215
a.getLeftOperand() = prev.asExpr()
216216
or
217217
a.getRightOperand() = prev.asExpr() and

csharp/ql/src/experimental/Security Features/CWE-759/HashWithoutSalt.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ module HashWithoutSaltConfig implements DataFlow::ConfigSig {
174174
mc.getAnArgument() = node.asExpr()
175175
)
176176
or
177-
exists(AddExpr e | node.asExpr() = e.getAnOperand()) // password+salt
177+
exists(AddOperation e | node.asExpr() = e.getAnOperand()) // password+salt
178178
or
179179
exists(InterpolatedStringExpr e | node.asExpr() = e.getAnInsert())
180180
or

0 commit comments

Comments
 (0)