Skip to content

Commit aeaca1d

Browse files
authored
Merge pull request #78 from microsoft/fix-join-order-in-zipslip-query
C#: Fix join order in `cs/zipslip`
2 parents 24517e3 + a826163 commit aeaca1d

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

csharp/ql/lib/semmle/code/csharp/commons/ComparisonTest.qll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ class ComparisonTest extends TComparisonTest {
305305
}
306306

307307
/** Gets an argument of this comparison test. */
308+
pragma[nomagic]
308309
Expr getAnArgument() {
309310
result = this.getFirstArgument() or
310311
result = this.getSecondArgument()

csharp/ql/lib/semmle/code/csharp/exprs/Call.qll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class Call extends Expr, @call {
4040
Callable getTarget() { none() }
4141

4242
/** Gets the `i`th argument to this call, if any. */
43+
pragma[nomagic]
4344
Expr getArgument(int i) { result = this.getChild(i) and i >= 0 }
4445

4546
/**

csharp/ql/lib/semmle/code/csharp/security/dataflow/ZipSlipQuery.qll

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,17 @@ class WrapperSanitizerMethodCall extends SanitizerMethodCall {
315315
)
316316
}
317317

318+
pragma[nomagic]
319+
private predicate paramFilePathIndex(int index) {
320+
index = wrapperMethod.paramFilePath().getIndex()
321+
}
322+
323+
318324
override Expr getFilePathArgument() {
319-
result = this.getArgument(wrapperMethod.paramFilePath().getIndex())
325+
exists(int index |
326+
this.paramFilePathIndex(index) and
327+
result = this.getArgument(index)
328+
)
320329
}
321330
}
322331

0 commit comments

Comments
 (0)