Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions change-notes/1.24/analysis-cpp.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ The following changes in version 1.24 affect C/C++ analysis in all applications.
|----------------------------|------------------------|------------------------------------------------------------------|
| Hard-coded Japanese era start date (`cpp/japanese-era/exact-era-date`) | | This query is no longer run on LGTM. |
| No space for zero terminator (`cpp/no-space-for-terminator`) | Fewer false positive results | This query has been modified to be more conservative when identifying which pointers point to null-terminated strings. This approach produces fewer, more accurate results. |
| Unsafe array for days of the year (`cpp/leap-year/unsafe-array-for-days-of-the-year`) | | This query is no longer run on LGTM. |

## Changes to libraries

Expand Down
3 changes: 2 additions & 1 deletion cpp/ql/src/Best Practices/Magic Constants/JapaneseEraDate.ql
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
* @problem.severity warning
* @id cpp/japanese-era/exact-era-date
* @precision low
* @tags reliability
* @tags maintainability
* reliability
* japanese-era
*/

Expand Down
1 change: 1 addition & 0 deletions cpp/ql/src/Likely Bugs/Leap Year/Adding365DaysPerYear.ql
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* @id cpp/leap-year/adding-365-days-per-year
* @precision medium
* @tags leap-year
* correctness
*/

import cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* @id cpp/leap-year/unchecked-after-arithmetic-year-modification
* @precision medium
* @tags leap-year
* correctness
*/

import cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* @id cpp/leap-year/unchecked-return-value-for-time-conversion-function
* @precision medium
* @tags leap-year
* correctness
*/

import cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
16 changes: 9 additions & 7 deletions cpp/ql/src/semmle/code/cpp/commons/DateTime.qll
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
}

Expand Down