Skip to content

Commit f8a2f5c

Browse files
committed
More FP tweaks.
1 parent d36a4df commit f8a2f5c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -394,9 +394,10 @@ module OperationToYearAssignmentConfig implements DataFlow::ConfigSig {
394394
or
395395
n.asExpr() instanceof IgnorableOperation
396396
or
397-
// Hijri or Persian years are not applicable for gregorian leap year checks
397+
// Flowing into variables that indicate likely non-gregorian years are barriers
398+
// e.g., names similar to hijri, persian, lunar, chinese, etc.
398399
exists(Variable v |
399-
v.getName().toLowerCase().matches(["%hijri%, %persian%"]) and
400+
v.getName().toLowerCase().matches(["%hijri%", "%persian%", "%lunar%", "%chinese%"]) and
400401
v.getAnAccess() = [n.asIndirectExpr(), n.asExpr()]
401402
)
402403
or
@@ -755,7 +756,9 @@ where
755756
not isYearModifiedWithCheck(sink.getNode().asExpr().(YearFieldAssignment).getYearFieldAccess()) and
756757
not isControlledByMonthEqualityCheckNonFebruary(sink.getNode().asExpr()) and
757758
// Check if a month is set in the same block as the year operation source
758-
// to a month that would be considered safe.
759+
// and the month value would indicate its set to any other month than february.
760+
// Finds if the source year node is in the same block as a source month block
761+
// and if the same for the sinks.
759762
not exists(DataFlow::Node monthValSrc, DataFlow::Node monthValSink |
760763
NonFebConstantToMonthAssignmentFlow::flow(monthValSrc, monthValSink) and
761764
monthValSrc.asExpr().getBasicBlock() = src.getNode().asExpr().getBasicBlock() and

0 commit comments

Comments
 (0)