mirror of
https://github.com/github/codeql.git
synced 2026-05-03 12:45:27 +02:00
CPP: Add a test case where a date is created.
This commit is contained in:
@@ -9,3 +9,4 @@
|
||||
| test.cpp:636:11:636:17 | tm_year | Field $@ on variable $@ has been modified, but no appropriate check for LeapYear was found. | test.cpp:56:6:56:12 | tm_year | tm_year | test.cpp:628:12:628:19 | timeinfo | timeinfo |
|
||||
| test.cpp:640:5:640:9 | wYear | Field $@ on variable $@ has been modified, but no appropriate check for LeapYear was found. | test.cpp:12:7:12:11 | wYear | wYear | test.cpp:629:13:629:14 | st | st |
|
||||
| test.cpp:642:5:642:9 | wYear | Field $@ on variable $@ has been modified, but no appropriate check for LeapYear was found. | test.cpp:12:7:12:11 | wYear | wYear | test.cpp:629:13:629:14 | st | st |
|
||||
| test.cpp:677:5:677:11 | tm_year | Field $@ on variable $@ has been modified, but no appropriate check for LeapYear was found. | test.cpp:56:6:56:12 | tm_year | tm_year | test.cpp:664:12:664:12 | t | t |
|
||||
|
||||
@@ -656,3 +656,27 @@ IncrementMonth(LPSYSTEMTIME pst)
|
||||
pst->wYear++;
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
|
||||
void mkDateTest(int year)
|
||||
{
|
||||
struct tm t;
|
||||
|
||||
t.tm_sec = 0;
|
||||
t.tm_min = 0;
|
||||
t.tm_hour = 0;
|
||||
t.tm_mday = 1; // day of the month - [1, 31]
|
||||
t.tm_mon = 0; // months since January - [0, 11]
|
||||
if (year >= 1900)
|
||||
{
|
||||
// 4-digit year
|
||||
t.tm_year = year - 1900; // GOOD
|
||||
} else if ((year >= 0) && (year < 100)) {
|
||||
// 2-digit year assumed in the range 2000 - 2099
|
||||
t.tm_year = year + 100; // GOOD [FALSE POSITIVE]
|
||||
} else {
|
||||
// fail
|
||||
}
|
||||
// ...
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user