mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
Merge pull request #2542 from geoffw0/datetime
C++: Sort through the leap year and japanese era queries
This commit is contained in:
@@ -5,7 +5,8 @@
|
||||
* @problem.severity warning
|
||||
* @id cpp/japanese-era/exact-era-date
|
||||
* @precision low
|
||||
* @tags reliability
|
||||
* @tags maintainability
|
||||
* reliability
|
||||
* japanese-era
|
||||
*/
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
* @id cpp/leap-year/adding-365-days-per-year
|
||||
* @precision medium
|
||||
* @tags leap-year
|
||||
* correctness
|
||||
*/
|
||||
|
||||
import cpp
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
* @id cpp/leap-year/unchecked-after-arithmetic-year-modification
|
||||
* @precision medium
|
||||
* @tags leap-year
|
||||
* correctness
|
||||
*/
|
||||
|
||||
import cpp
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
* @id cpp/leap-year/unchecked-return-value-for-time-conversion-function
|
||||
* @precision medium
|
||||
* @tags leap-year
|
||||
* correctness
|
||||
*/
|
||||
|
||||
import cpp
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* @kind problem
|
||||
* @problem.severity warning
|
||||
* @id cpp/leap-year/unsafe-array-for-days-of-the-year
|
||||
* @precision medium
|
||||
* @precision low
|
||||
* @tags security
|
||||
* leap-year
|
||||
*/
|
||||
|
||||
@@ -10,22 +10,24 @@ import cpp
|
||||
class PackedTimeType extends Type {
|
||||
PackedTimeType() {
|
||||
this.getName() = "_FILETIME" or
|
||||
this.getName().matches("_FILETIME %")
|
||||
this.(DerivedType).getBaseType*().getName() = "_FILETIME"
|
||||
}
|
||||
}
|
||||
|
||||
private predicate timeType(string typeName) {
|
||||
typeName = "_SYSTEMTIME" or
|
||||
typeName = "SYSTEMTIME" or
|
||||
typeName = "tm"
|
||||
}
|
||||
|
||||
/**
|
||||
* A type that is used to represent times and dates in an 'unpacked' form, that is,
|
||||
* with separate fields for day, month, year etc.
|
||||
*/
|
||||
class UnpackedTimeType extends Type {
|
||||
UnpackedTimeType() {
|
||||
this.getName() = "_SYSTEMTIME" or
|
||||
this.getName() = "SYSTEMTIME" or
|
||||
this.getName() = "tm" or
|
||||
this.getName().matches("_SYSTEMTIME %") or
|
||||
this.getName().matches("SYSTEMTIME %") or
|
||||
this.getName().matches("tm %")
|
||||
timeType(this.getName()) or
|
||||
timeType(this.(DerivedType).getBaseType*().getName())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user