Skip to content

Commit 94a9b3e

Browse files
committed
fix all ql/counting-to-zero in some languages
1 parent 7149b98 commit 94a9b3e

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

python/ql/src/Security/CWE-022/TarSlip.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class ExtractAllSink extends TaintSink {
8585

8686
ExtractAllSink() {
8787
this = call.getFunction().(AttrNode).getObject("extractall") and
88-
count(call.getAnArg()) = 0
88+
not exists(call.getAnArg())
8989
}
9090

9191
override predicate sinks(TaintKind kind) { kind instanceof OpenTarFile }

python/ql/src/analysis/Consistency.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ predicate function_object_consistency(string clsname, string problem, string wha
194194
exists(FunctionObject func | clsname = func.getAQlClass() |
195195
what = func.getName() and
196196
(
197-
count(func.descriptiveString()) = 0 and problem = "no descriptiveString()"
197+
not exists(func.descriptiveString()) and problem = "no descriptiveString()"
198198
or
199199
exists(int c | c = strictcount(func.descriptiveString()) and c > 1 |
200200
problem = c + "descriptiveString()s"

ql/ql/src/queries/performance/ClassPredicateDoesntMentionThis.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ predicate isLiteralComparison(ComparisonFormula eq) {
4040
or
4141
exists(NewTypeBranch nt |
4242
rhs.(Call).getTarget() = nt and
43-
count(nt.getField(_)) = 0
43+
not exists(nt.getField(_))
4444
)
4545
)
4646
)
@@ -69,7 +69,7 @@ predicate isSingleton(Type ty) {
6969
or
7070
isSingleton(ty.getASuperType())
7171
or
72-
exists(NewTypeBranch br | count(br.getField(_)) = 0 |
72+
exists(NewTypeBranch br | not exists(br.getField(_)) |
7373
ty.(NewTypeBranchType).getDeclaration() = br
7474
or
7575
br = unique(NewTypeBranch br2 | br2 = ty.(NewTypeType).getDeclaration().getABranch())

0 commit comments

Comments
 (0)