Merge pull request #3 from geoffw0/dates-fix · github/codeql@6a05c84 · GitHub
Skip to content

Commit 6a05c84

Browse files
authored
Merge pull request #3 from geoffw0/dates-fix
CPP: Fixes for C++: Mishandling Japanese Era and Leap Year in calculations #1354
2 parents 7ff8fcd + 8ebc0b9 commit 6a05c84

6 files changed

Lines changed: 44 additions & 11 deletions
Lines changed: 20 additions & 0 deletions

‎cpp/ql/src/Likely Bugs/Leap Year/LeapYear.qhelp‎

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,9 @@
22
"-//Semmle//qhelp//EN"
33
"qhelp.dtd">
44
<qhelp>
5-
<overview>
6-
<p>The leap year rule for the Gregorian calendar, which has become the internationally accepted civil calendar, is: every year that is exactly divisible by four is a leap year, except for years that are exactly divisible by 100, but these centurial years are leap years if they are exactly divisible by 400.</p>
7-
<p>A leap year bug occurs when software (in any language) is written without consideration of leap year logic, or with flawed logic to calculate leap years; which typically results in incorrect results.</p>
8-
<p>The impact of these bugs may range from almost unnoticeable bugs such as an incorrect date, to severe bugs that affect reliability, availability or even the security of the affected system.</p>
9-
</overview>
10-
11-
<references>
12-
<li>U.S. Naval Observatory Website - <a href="https://aa.usno.navy.mil/faq/docs/calendars.php"> Introduction to Calendars</a></li>
13-
<li>Wikipedia - <a href="https://en.wikipedia.org/wiki/Leap_year_bug"> Leap year bug</a> </li>
14-
<li>Microsoft Azure blog - <a href="https://azure.microsoft.com/en-us/blog/is-your-code-ready-for-the-leap-year/"> Is your code ready for the leap year?</a> </li>
15-
</references>
5+
<fragment>
6+
<p>The leap year rule for the Gregorian calendar, which has become the internationally accepted civil calendar, is: every year that is exactly divisible by four is a leap year, except for years that are exactly divisible by 100, but these centurial years are leap years if they are exactly divisible by 400.</p>
7+
<p>A leap year bug occurs when software (in any language) is written without consideration of leap year logic, or with flawed logic to calculate leap years; which typically results in incorrect results.</p>
8+
<p>The impact of these bugs may range from almost unnoticeable bugs such as an incorrect date, to severe bugs that affect reliability, availability or even the security of the affected system.</p>
9+
</fragment>
1610
</qhelp>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!DOCTYPE qhelp PUBLIC
2+
"-//Semmle//qhelp//EN"
3+
"qhelp.dtd">
4+
<qhelp>
5+
<fragment>
6+
<li>U.S. Naval Observatory Website - <a href="https://aa.usno.navy.mil/faq/docs/calendars.php"> Introduction to Calendars</a></li>
7+
<li>Wikipedia - <a href="https://en.wikipedia.org/wiki/Leap_year_bug"> Leap year bug</a> </li>
8+
<li>Microsoft Azure blog - <a href="https://azure.microsoft.com/en-us/blog/is-your-code-ready-for-the-leap-year/"> Is your code ready for the leap year?</a> </li>
9+
</fragment>
10+
</qhelp>

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,7 @@
2121
<sample src="UncheckedLeapYearAfterYearModificationGood.c" />
2222
</example>
2323

24+
<references>
25+
<include src="LeapYearReferences.qhelp" />
26+
</references>
2427
</qhelp>

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,7 @@
3333
<sample src="UncheckedLeapYearAfterYearModificationGood.c" />
3434
</example>
3535

36+
<references>
37+
<include src="LeapYearReferences.qhelp" />
38+
</references>
3639
</qhelp>

‎cpp/ql/src/Likely Bugs/Leap Year/UnsafeArrayForDaysOfYear.qhelp‎

Lines changed: 3 additions & 0 deletions

0 commit comments

Comments
 (0)