Skip to content

Commit 2e7dba2

Browse files
committed
Comment cleanup
1 parent 8756089 commit 2e7dba2

File tree

1 file changed

+4
-19
lines changed

1 file changed

+4
-19
lines changed

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

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -82,29 +82,16 @@ class IgnorableCharLiteralArithmetic extends IgnorableOperation {
8282

8383
/**
8484
* Constants often used in date conversions (from one date data type to another)
85+
* Numerous examples exist, like 1900 or 2000 that convert years from one
86+
* representation to another. All examples found tend to be 100 or greater,
87+
* so just using this as a heuristic for detecting such conversion constants.
88+
* Also '0' is sometimes observed as an atoi style conversion.
8589
*/
8690
bindingset[c]
8791
predicate isLikelyConversionConstant(int c) {
8892
exists(int i | i = c.abs() | i >= 100)
8993
or
9094
c = 0
91-
// c = 146097 or // days in 400-year Gregorian cycle
92-
// c = 36524 or // days in 100-year Gregorian subcycle
93-
// c = 1461 or // days in 4-year cycle (incl. 1 leap)
94-
// c = 32044 or // Fliegel–van Flandern JDN epoch shift
95-
// c = 1721425 or // JDN of 0001‑01‑01 (Gregorian)
96-
// c = 1721119 or // alt epoch offset
97-
// c = 2400000 or // MJD → JDN conversion
98-
// c = 2400001 or // alt MJD → JDN conversion
99-
// c = 2141 or // fixed‑point month/day extraction
100-
// c = 2000 or // observed in some conversions
101-
// c = 65536 or // observed in some conversions
102-
// c = 7834 or // observed in some conversions
103-
// c = 256 or // observed in some conversions
104-
// c = 1900 or // struct tm base‑year offset; harmless
105-
// c = 1899 or // Observed in uses with 1900 to address off by one scenarios
106-
// c = 292275056 or // qdatetime.h Qt Core year range first year constant
107-
// c = 292278994 // qdatetime.h Qt Core year range last year constant
10895
}
10996

11097
/**
@@ -311,7 +298,6 @@ module OperationToYearAssignmentConfig implements DataFlow::ConfigSig {
311298
predicate isBarrierIn(DataFlow::Node n) { isSource(n) }
312299

313300
predicate isBarrierOut(DataFlow::Node n) { isSink(n) }
314-
315301
// DataFlow::FlowFeature getAFeature() { result instanceof DataFlow::FeatureHasSourceCallContext }
316302
}
317303

@@ -354,7 +340,6 @@ module YearFieldAccessToLeapYearCheckConfig implements DataFlow::ConfigSig {
354340
// DataFlow::FlowFeature getAFeature() {
355341
// result instanceof DataFlow::FeatureEqualSourceSinkCallContext
356342
// }
357-
358343
/**
359344
* Enforcing the check must occur in the same call context as the source,
360345
* i.e., do not return from the source function and check in a caller.

0 commit comments

Comments
 (0)