Skip to content

Commit cb80aa3

Browse files
committed
CPP: Rename the classes for time structs.
1 parent 2e31f48 commit cb80aa3

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

cpp/ql/src/Likely Bugs/Leap Year/LeapYear.qll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ class FiletimeYearArithmeticOperationCheckConfiguration extends DataFlow::Config
238238

239239
override predicate isSink(DataFlow::Node sink) {
240240
exists(StructLikeClass dds, FieldAccess fa, AssignExpr aexpr, Expr e | e = sink.asExpr() |
241-
dds instanceof FileTimeStruct and
241+
dds instanceof PackedTimeType and
242242
fa.getQualifier().getUnderlyingType() = dds and
243243
fa.isModified() and
244244
aexpr.getAChild() = fa and
@@ -269,7 +269,7 @@ class PossibleYearArithmeticOperationCheckConfiguration extends DataFlow::Config
269269
e = node1.asExpr() and
270270
aexpr = node2.asExpr()
271271
|
272-
(dds instanceof FileTimeStruct or dds instanceof DateDataStruct) and
272+
(dds instanceof PackedTimeType or dds instanceof UnpackedTimeType) and
273273
fa.getQualifier().getUnderlyingType() = dds and
274274
aexpr.getLValue() = fa and
275275
aexpr.getRValue().getAChild*() = e
@@ -278,7 +278,7 @@ class PossibleYearArithmeticOperationCheckConfiguration extends DataFlow::Config
278278

279279
override predicate isSink(DataFlow::Node sink) {
280280
exists(StructLikeClass dds, FieldAccess fa, AssignExpr aexpr | aexpr = sink.asExpr() |
281-
(dds instanceof FileTimeStruct or dds instanceof DateDataStruct) and
281+
(dds instanceof PackedTimeType or dds instanceof UnpackedTimeType) and
282282
fa.getQualifier().getUnderlyingType() = dds and
283283
fa.isModified() and
284284
aexpr.getLValue() = fa

cpp/ql/src/Likely Bugs/Leap Year/UncheckedReturnValueForTimeFunctions.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class DateStructModifiedFieldAccess extends LeapYearFieldAccess {
2626
exists(Field f, StructLikeClass struct |
2727
f.getAnAccess() = this and
2828
struct.getAField() = f and
29-
struct.getUnderlyingType() instanceof DateDataStruct and
29+
struct.getUnderlyingType() instanceof UnpackedTimeType and
3030
this.isModifiedByArithmeticOperation()
3131
)
3232
}
@@ -64,7 +64,7 @@ from FunctionCall fcall, TimeConversionFunction trf, Variable var
6464
where
6565
fcall = trf.getACallToThisFunction() and
6666
fcall instanceof ExprInVoidContext and
67-
var.getUnderlyingType() instanceof DateDataStruct and
67+
var.getUnderlyingType() instanceof UnpackedTimeType and
6868
(
6969
exists(AddressOfExpr aoe |
7070
aoe = fcall.getAnArgument() and

cpp/ql/src/semmle/code/cpp/commons/DateTime.qll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import cpp
77
/**
88
* A type that is used to represent time in a 'packed' form, such as an integer.
99
*/
10-
class FileTimeStruct extends Type {
11-
FileTimeStruct() {
10+
class PackedTimeType extends Type {
11+
PackedTimeType() {
1212
this.getName() = "_FILETIME"
1313
or this.getName().matches("_FILETIME %")
1414
}
@@ -18,8 +18,8 @@ class FileTimeStruct extends Type {
1818
* A type that is used to represent times and dates in an 'unpacked' form, that is,
1919
* with separate fields for day, month, year etc.
2020
*/
21-
class DateDataStruct extends Type {
22-
DateDataStruct() {
21+
class UnpackedTimeType extends Type {
22+
UnpackedTimeType() {
2323
this.getName() = "_SYSTEMTIME"
2424
or this.getName() = "SYSTEMTIME"
2525
or this.getName() = "tm"

0 commit comments

Comments
 (0)