mirror of
https://github.com/github/codeql.git
synced 2026-05-02 20:25:13 +02:00
C#: Auto format
This commit is contained in:
@@ -63,9 +63,7 @@ private predicate localFlowStep(DataFlow::Node nodeFrom, DataFlow::Node nodeTo)
|
||||
private predicate reachesDisposeCall(DisposeCall disposeCall, DataFlow::Node node) {
|
||||
localFlowStep(node, DataFlow::exprNode(disposeCall.getQualifier()))
|
||||
or
|
||||
exists(DataFlow::Node mid | reachesDisposeCall(disposeCall, mid) |
|
||||
localFlowStep(node, mid)
|
||||
)
|
||||
exists(DataFlow::Node mid | reachesDisposeCall(disposeCall, mid) | localFlowStep(node, mid))
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -34,6 +34,10 @@ class UnsafeYearCreationFromArithmeticConfiguration extends TaintTracking::Confi
|
||||
}
|
||||
}
|
||||
|
||||
from UnsafeYearCreationFromArithmeticConfiguration config, DataFlow::PathNode source, DataFlow::PathNode sink
|
||||
from
|
||||
UnsafeYearCreationFromArithmeticConfiguration config, DataFlow::PathNode source,
|
||||
DataFlow::PathNode sink
|
||||
where config.hasFlowPath(source, sink)
|
||||
select sink, source, sink, "This $@ based on a 'System.DateTime.Year' property is used in a construction of a new 'System.DateTime' object, flowing to the 'year' argument.", source, "arithmetic operation"
|
||||
select sink, source, sink,
|
||||
"This $@ based on a 'System.DateTime.Year' property is used in a construction of a new 'System.DateTime' object, flowing to the 'year' argument.",
|
||||
source, "arithmetic operation"
|
||||
|
||||
@@ -26,7 +26,8 @@ predicate isExactEraStartDateCreation(ObjectCreation cr) {
|
||||
cr.getType().hasQualifiedName("System.DateTime") or
|
||||
cr.getType().hasQualifiedName("System.DateTimeOffset")
|
||||
) and
|
||||
isEraStart(cr.getArgument(0).getValue().toInt(), cr.getArgument(1).getValue().toInt(), cr.getArgument(2).getValue().toInt())
|
||||
isEraStart(cr.getArgument(0).getValue().toInt(), cr.getArgument(1).getValue().toInt(),
|
||||
cr.getArgument(2).getValue().toInt())
|
||||
}
|
||||
|
||||
predicate isDateFromJapaneseCalendarToDateTime(MethodCall mc) {
|
||||
@@ -64,9 +65,12 @@ predicate isDateFromJapaneseCalendarCreation(ObjectCreation cr) {
|
||||
|
||||
from Expr expr, string message
|
||||
where
|
||||
isDateFromJapaneseCalendarToDateTime(expr) and message = "'DateTime' created from Japanese calendar with explicit or current era and hard-coded year."
|
||||
isDateFromJapaneseCalendarToDateTime(expr) and
|
||||
message = "'DateTime' created from Japanese calendar with explicit or current era and hard-coded year."
|
||||
or
|
||||
isDateFromJapaneseCalendarCreation(expr) and message = "'DateTime' constructed from Japanese calendar with explicit or current era and hard-coded year."
|
||||
isDateFromJapaneseCalendarCreation(expr) and
|
||||
message = "'DateTime' constructed from Japanese calendar with explicit or current era and hard-coded year."
|
||||
or
|
||||
isExactEraStartDateCreation(expr) and message = "Hard-coded the beginning of the Japanese Heisei era."
|
||||
isExactEraStartDateCreation(expr) and
|
||||
message = "Hard-coded the beginning of the Japanese Heisei era."
|
||||
select expr, message
|
||||
|
||||
@@ -41,9 +41,7 @@ private predicate alwaysNullExpr(Expr expr) {
|
||||
or
|
||||
alwaysNullMethod(expr.(StaticCall).getTarget())
|
||||
or
|
||||
forex(VariableUpdate vu | DefUse::variableUpdateUse(_, vu, expr) |
|
||||
alwaysNullVariableUpdate(vu)
|
||||
)
|
||||
forex(VariableUpdate vu | DefUse::variableUpdateUse(_, vu, expr) | alwaysNullVariableUpdate(vu))
|
||||
}
|
||||
|
||||
pragma[noinline]
|
||||
|
||||
@@ -1303,9 +1303,7 @@ class UsingDeclStmt extends LocalVariableDeclStmt, UsingStmt, @using_decl_stmt {
|
||||
result = LocalVariableDeclStmt.super.getVariableDeclExpr(n)
|
||||
}
|
||||
|
||||
override Expr getAnExpr() {
|
||||
result = this.getAVariableDeclExpr().getInitializer()
|
||||
}
|
||||
override Expr getAnExpr() { result = this.getAVariableDeclExpr().getInitializer() }
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,6 +4,6 @@ query predicate edges(ControlFlow::Node node1, ControlFlow::Node node2, string l
|
||||
label = "semmle.label" and
|
||||
exists(ControlFlow::SuccessorType t |
|
||||
node2 = node1.getASuccessorByType(t) and value = t.toString()
|
||||
)
|
||||
and node1.getEnclosingCallable().hasName("NullCoalescing")
|
||||
) and
|
||||
node1.getEnclosingCallable().hasName("NullCoalescing")
|
||||
}
|
||||
|
||||
@@ -2,4 +2,4 @@ import csharp
|
||||
|
||||
from LocalFunction fn, string modifier
|
||||
where fn.hasModifier(modifier)
|
||||
select fn, modifier
|
||||
select fn, modifier
|
||||
|
||||
@@ -4,6 +4,6 @@ query predicate edges(ControlFlow::Node node1, ControlFlow::Node node2, string l
|
||||
label = "semmle.label" and
|
||||
exists(ControlFlow::SuccessorType t |
|
||||
node2 = node1.getASuccessorByType(t) and value = t.toString()
|
||||
)
|
||||
and node1.getEnclosingCallable().hasName("TestUsingDeclarations")
|
||||
) and
|
||||
node1.getEnclosingCallable().hasName("TestUsingDeclarations")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user