Skip to content

Commit bcf4c57

Browse files
committed
Merge branch 'main' into redosPrefix
2 parents d052b1e + e39475d commit bcf4c57

File tree

159 files changed

+1770
-1540
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

159 files changed

+1770
-1540
lines changed

cpp/ql/lib/experimental/semmle/code/cpp/semantic/SemanticExprSpecific.qll

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -292,22 +292,20 @@ module SemanticExprConfig {
292292

293293
class Guard = IRGuards::IRGuardCondition;
294294

295-
predicate guard(Guard guard, BasicBlock block) {
296-
block = guard.(IRGuards::IRGuardCondition).getBlock()
297-
}
295+
predicate guard(Guard guard, BasicBlock block) { block = guard.getBlock() }
298296

299297
Expr getGuardAsExpr(Guard guard) { result = guard }
300298

301299
predicate equalityGuard(Guard guard, Expr e1, Expr e2, boolean polarity) {
302-
guard.(IRGuards::IRGuardCondition).comparesEq(e1.getAUse(), e2.getAUse(), 0, true, polarity)
300+
guard.comparesEq(e1.getAUse(), e2.getAUse(), 0, true, polarity)
303301
}
304302

305303
predicate guardDirectlyControlsBlock(Guard guard, BasicBlock controlled, boolean branch) {
306-
guard.(IRGuards::IRGuardCondition).controls(controlled, branch)
304+
guard.controls(controlled, branch)
307305
}
308306

309307
predicate guardHasBranchEdge(Guard guard, BasicBlock bb1, BasicBlock bb2, boolean branch) {
310-
guard.(IRGuards::IRGuardCondition).controlsEdge(bb1, bb2, branch)
308+
guard.controlsEdge(bb1, bb2, branch)
311309
}
312310

313311
Guard comparisonGuard(Expr e) { result = e }

cpp/ql/lib/semmle/code/cpp/File.qll

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,6 @@ class Folder extends Container, @folder {
218218
class File extends Container, @file {
219219
override string getAbsolutePath() { files(underlyingElement(this), result) }
220220

221-
override string toString() { result = Container.super.toString() }
222-
223221
override string getAPrimaryQlClass() { result = "File" }
224222

225223
override Location getLocation() {

cpp/ql/src/Likely Bugs/Memory Management/UsingExpiredStackAddress.ql

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,11 @@ class PathElement extends TPathElement {
268268
predicate isSink(IRBlock block) { exists(this.asSink(block)) }
269269

270270
string toString() {
271-
result = [asStore().toString(), asCall(_).toString(), asMid().toString(), asSink(_).toString()]
271+
result =
272+
[
273+
this.asStore().toString(), this.asCall(_).toString(), this.asMid().toString(),
274+
this.asSink(_).toString()
275+
]
272276
}
273277

274278
predicate hasLocationInfo(

cpp/ql/src/experimental/Security/CWE/CWE-125/DangerousWorksWithMultibyteOrWideCharacters.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ predicate findUseCharacterConversion(Expr exp, string msg) {
6767
exists(FunctionCall fc |
6868
fc = exp and
6969
(
70-
exists(Loop lptmp | lptmp = fc.getEnclosingStmt().getParentStmt*()) and
70+
fc.getEnclosingStmt().getParentStmt*() instanceof Loop and
7171
fc.getTarget().hasName(["mbtowc", "mbrtowc", "_mbtowc_l"]) and
7272
not fc.getArgument(0).isConstant() and
7373
not fc.getArgument(1).isConstant() and

cpp/ql/src/experimental/Security/CWE/CWE-190/DangerousUseOfTransformationAfterOperation.ql

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,8 @@ predicate conversionDoneLate(MulExpr mexp) {
4444
mexp.getEnclosingElement().(ComparisonOperation).hasOperands(mexp, e0) and
4545
e0.getType().getSize() = mexp.getConversion().getConversion().getType().getSize()
4646
or
47-
e0.(FunctionCall)
48-
.getTarget()
49-
.getParameter(argumentPosition(e0.(FunctionCall), mexp, _))
50-
.getType()
51-
.getSize() = mexp.getConversion().getConversion().getType().getSize()
47+
e0.(FunctionCall).getTarget().getParameter(argumentPosition(e0, mexp, _)).getType().getSize() =
48+
mexp.getConversion().getConversion().getType().getSize()
5249
)
5350
)
5451
}
@@ -75,7 +72,7 @@ predicate signSmallerWithEqualSizes(MulExpr mexp) {
7572
ae.getRValue().getUnderlyingType().(IntegralType).isUnsigned() and
7673
ae.getLValue().getUnderlyingType().(IntegralType).isSigned() and
7774
(
78-
not exists(DivExpr de | mexp.getParent*() = de)
75+
not mexp.getParent*() instanceof DivExpr
7976
or
8077
exists(DivExpr de, Expr ec |
8178
e2.isConstant() and

csharp/ql/lib/semmle/code/cil/Types.qll

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,8 +309,6 @@ class FunctionPointerType extends Type, CustomModifierReceiver, Parameterizable,
309309
/** Gets the calling convention. */
310310
int getCallingConvention() { cil_function_pointer_calling_conventions(this, result) }
311311

312-
override string toString() { result = Type.super.toString() }
313-
314312
/** Holds if the return type is `void`. */
315313
predicate returnsVoid() { this.getReturnType() instanceof VoidType }
316314

csharp/ql/lib/semmle/code/csharp/Callable.qll

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -215,11 +215,7 @@ class Callable extends DotNet::Callable, Parameterizable, ExprOrStmtParent, @cal
215215
/** Gets a `Call` that has this callable as a target. */
216216
Call getACall() { this = result.getTarget() }
217217

218-
override Parameter getParameter(int n) { result = Parameterizable.super.getParameter(n) }
219-
220218
override Parameter getAParameter() { result = Parameterizable.super.getAParameter() }
221-
222-
override int getNumberOfParameters() { result = Parameterizable.super.getNumberOfParameters() }
223219
}
224220

225221
/**
@@ -276,8 +272,6 @@ class Method extends Callable, Virtualizable, Attributable, @method {
276272
predicate hasParams() { exists(this.getParamsType()) }
277273

278274
// Remove when `Callable.isOverridden()` is removed
279-
override predicate isOverridden() { Virtualizable.super.isOverridden() }
280-
281275
override predicate fromSource() {
282276
Callable.super.fromSource() and
283277
not this.isCompilerGenerated()
@@ -472,8 +466,6 @@ class RecordCloneMethod extends Method, DotNet::RecordCloneCallable {
472466
override Constructor getConstructor() {
473467
result = DotNet::RecordCloneCallable.super.getConstructor()
474468
}
475-
476-
override string toString() { result = Method.super.toString() }
477469
}
478470

479471
/**

csharp/ql/lib/semmle/code/csharp/Namespace.qll

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,6 @@ class Namespace extends DotNet::Namespace, TypeContainer, Declaration, @namespac
116116
override Location getALocation() { result = this.getADeclaration().getALocation() }
117117

118118
override string toString() { result = DotNet::Namespace.super.toString() }
119-
120-
override predicate hasQualifiedName(string a, string b) {
121-
DotNet::Namespace.super.hasQualifiedName(a, b)
122-
}
123119
}
124120

125121
/**

csharp/ql/lib/semmle/code/csharp/Property.qll

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ class DeclarationWithAccessors extends AssignableMember, Virtualizable, Attribut
4242
}
4343

4444
override Type getType() { none() }
45-
46-
override string toString() { result = AssignableMember.super.toString() }
4745
}
4846

4947
/**

csharp/ql/lib/semmle/code/csharp/dataflow/SSA.qll

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,6 @@ module Ssa {
163163
* (`ImplicitDefinition`), or a phi node (`PhiNode`).
164164
*/
165165
class Definition extends SsaImpl::Definition {
166-
final override SourceVariable getSourceVariable() {
167-
result = SsaImpl::Definition.super.getSourceVariable()
168-
}
169-
170166
/**
171167
* Gets the control flow node of this SSA definition, if any. Phi nodes are
172168
* examples of SSA definitions without a control flow node, as they are

0 commit comments

Comments
 (0)