You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
selectsink,"This arithmetic operation $@ uses a constant value of 365 ends up modifying the date/time located at $@, without considering leap year scenarios."
19
-
,source,source.toString()
20
-
,sink,sink.toString()
18
+
selectsink,
19
+
"This arithmetic operation $@ uses a constant value of 365 ends up modifying the date/time located at $@, without considering leap year scenarios.",
// If there is a successor or predecessor that sets the month = 1
47
-
orexists(MonthFieldAccessmfa,AssignExprae|
48
-
mfa.getQualifier()=var.getAnAccess()
49
-
andmfa.isModified()
50
-
and(mfa=yfa.getASuccessor*()
51
-
oryfa=mfa.getASuccessor*())
52
-
andae=mfa.getEnclosingElement()
53
-
andae.getAnOperand().getValue().toInt()=1
54
-
)
55
-
)
56
-
)
57
-
selectyfa
58
-
,"Field $@ on variable $@ has been modified, but no appropriate check for LeapYear was found.",yfa.getTarget(),yfa.getTarget().toString(),var,var.toString()
17
+
exists(VariableAccessva|
18
+
yfa.getQualifier()=vaand
19
+
var.getAnAccess()=vaand
20
+
// The year is modified with an arithmetic operation. Avoid values that are likely false positives
// Remove any instance where the year is changed, but the month is set to 1 (year wrapping)
100
+
exists(MonthFieldAccessmfa,AssignExprae|
101
+
mfa.getQualifier()=var.getAnAccess()and
102
+
mfa.isModified()and
103
+
mfa=fcall.getAPredecessor*()and
104
+
ae=mfa.getEnclosingElement()and
105
+
ae.getAnOperand().getValue().toInt()=1
96
106
)
97
107
)
98
-
// Remove any instance where the year is changed, but the month is set to 1 (year wrapping)
99
-
orexists(MonthFieldAccessmfa,AssignExprae|
100
-
mfa.getQualifier()=var.getAnAccess()
101
-
andmfa.isModified()
102
-
andmfa=fcall.getAPredecessor*()
103
-
andae=mfa.getEnclosingElement()
104
-
andae.getAnOperand().getValue().toInt()=1
105
-
)
106
-
)
107
-
selectfcall,"Return value of $@ function should be verified to check for any error because variable $@ is not guaranteed to be safe.",trf,trf.getQualifiedName().toString(),var,var.getName()
108
+
selectfcall,
109
+
"Return value of $@ function should be verified to check for any error because variable $@ is not guaranteed to be safe.",
selectelement,"There is an array or std::vector allocation with a hard-coded set of 365 elements, which may indicate the number of days in a year without considering leap year scenarios."
"There is an array or std::vector allocation with a hard-coded set of 365 elements, which may indicate the number of days in a year without considering leap year scenarios."
0 commit comments