Skip to content

Commit 05d0d84

Browse files
committed
Editorial changes
1 parent d5145d9 commit 05d0d84

File tree

1 file changed

+37
-32
lines changed

1 file changed

+37
-32
lines changed

change-notes/1.24/analysis-cpp.md

Lines changed: 37 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ The following changes in version 1.24 affect C/C++ analysis in all applications.
44

55
## General improvements
66

7+
You can now suppress alerts using either single-line block comments (`/* ... */`) or line comments (`// ...`).
8+
79
## New queries
810

911
| **Query** | **Tags** | **Purpose** |
@@ -12,23 +14,27 @@ The following changes in version 1.24 affect C/C++ analysis in all applications.
1214

1315
## Changes to existing queries
1416

17+
A new taint-tracking library is used by all the security queries that track tainted values
18+
(`cpp/path-injection`, `cpp/cgi-xss`, `cpp/sql-injection`, `cpp/uncontrolled-process-operation`,
19+
`cpp/unbounded-write`, `cpp/tainted-format-string`, `cpp/tainted-format-string-through-global`,
20+
`cpp/uncontrolled-arithmetic`, `cpp/uncontrolled-allocation-size`, `cpp/user-controlled-bypass`,
21+
`cpp/cleartext-storage-buffer`, `cpp/tainted-permissions-check`).
22+
These queries now have more precise results and also offer _path explanations_ so you can explore the results easily.
23+
There is a performance cost to this, and the LGTM query suite will overall run slower than before.
24+
1525
| **Query** | **Expected impact** | **Change** |
1626
|----------------------------|------------------------|------------------------------------------------------------------|
17-
| All CWE-specific queries using taint tracking (`cpp/path-injection`, `cpp/cgi-xss`, `cpp/sql-injection`, `cpp/uncontrolled-process-operation`, `cpp/unbounded-write`, `cpp/tainted-format-string`, `cpp/tainted-format-string-through-global`, `cpp/uncontrolled-arithmetic`, `cpp/uncontrolled-allocation-size`, `cpp/user-controlled-bypass`, `cpp/cleartext-storage-buffer`, `cpp/tainted-permissions-check`) | More correct results | A new taint-tracking library is used, giving more precise results and offering _path explanations_ for results. There is a performance cost to this, and the LGTM suite will overall run slower than before. |
18-
| Boost\_asio TLS Settings Misconfiguration (`cpp/boost/tls-settings-misconfiguration`) | Query id change | Query id renamed from `cpp/boost/tls_settings_misconfiguration` (underscores to dashes) |
27+
| Boost\_asio TLS Settings Misconfiguration (`cpp/boost/tls-settings-misconfiguration`) | Query id change | The identifier was updated to use dashes in place of underscores (previous identifier `cpp/boost/tls_settings_misconfiguration`). |
1928
| Buffer not sufficient for string (`cpp/overflow-calculated`) | More true positive results | This query now identifies a wider variety of buffer allocations using the `semmle.code.cpp.models.interfaces.Allocation` library. |
2029
| Hard-coded Japanese era start date (`cpp/japanese-era/exact-era-date`) | | This query is no longer run on LGTM. |
2130
| Memory is never freed (`cpp/memory-never-freed`) | More true positive results | This query now identifies a wider variety of buffer allocations using the `semmle.code.cpp.models.interfaces.Allocation` library. |
2231
| Memory may not be freed (`cpp/memory-may-not-be-freed`) | More true positive results | This query now identifies a wider variety of buffer allocations using the `semmle.code.cpp.models.interfaces.Allocation` library. |
23-
| Mismatching new/free or malloc/delete (`cpp/new-free-mismatch`) | Fewer false positive results | Fixed false positive results in template code. |
24-
| Missing return statement (`cpp/missing-return`) | Fewer false positive results | Functions containing `asm` statements are no longer highlighted by this query. |
25-
| Missing return statement (`cpp/missing-return`) | More accurate locations | Locations reported by this query are now more accurate in some cases. |
26-
| No space for zero terminator (`cpp/no-space-for-terminator`) | More correct results | String arguments to formatting functions are now (usually) expected to be null terminated strings. |
27-
| No space for zero terminator (`cpp/no-space-for-terminator`) | More true positive results | This query now identifies a wider variety of buffer allocations using the `semmle.code.cpp.models.interfaces.Allocation` library. |
28-
| 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. |
32+
| Mismatching new/free or malloc/delete (`cpp/new-free-mismatch`) | Fewer false positive results | Improved handling of template code gives greater precision. |
33+
| Missing return statement (`cpp/missing-return`) | Fewer false positive results and more accurate locations | Functions containing `asm` statements are no longer highlighted by this query. The locations reported by this query are now more accurate in some cases. |
34+
| No space for zero terminator (`cpp/no-space-for-terminator`) | More results with greater precision | The query gives more precise results for a wider variety of buffer allocations. String arguments to formatting functions are now (usually) expected to be null terminated strings. Use of the `semmle.code.cpp.models.interfaces.Allocation` library identifies problems with a wider variety of buffer allocations. This query is also more conservative when identifying which pointers point to null-terminated strings. |
2935
| Overflow in uncontrolled allocation size (`cpp/uncontrolled-allocation-size`) | Fewer false positive results | The query now produces fewer, more accurate results. Cases where the tainted allocation size is range checked are more reliably excluded. |
3036
| Overloaded assignment does not return 'this' (`cpp/assignment-does-not-return-this`) | Fewer false positive results | This query no longer reports incorrect results in template classes. |
31-
| Signed overflow check (`cpp/signed-overflow-check`), Pointer overflow check (`cpp/pointer-overflow-check`), Possibly wrong buffer size in string copy (`cpp/bad-strncpy-size`) | More correct results | A new library is used for determining which expressions have identical value, giving more precise results. There is a performance cost to this, and the LGTM suite will overall run slower than before. |
37+
| Pointer overflow check (`cpp/pointer-overflow-check`),</br> Possibly wrong buffer size in string copy (`cpp/bad-strncpy-size`),</br> Signed overflow check (`cpp/signed-overflow-check`) | More correct results | A new library is used for determining which expressions have identical value, giving more precise results. There is a performance cost to this, and the LGTM suite will overall run slower than before. |
3238
| 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. |
3339
| Unsigned comparison to zero (`cpp/unsigned-comparison-zero`) | More correct results | This query now also looks for comparisons of the form `0 <= x`. |
3440

@@ -40,9 +46,9 @@ The following changes in version 1.24 affect C/C++ analysis in all applications.
4046
* The data-flow library (`semmle.code.cpp.dataflow.DataFlow` and
4147
`semmle.code.cpp.dataflow.TaintTracking`) has been improved, which affects
4248
and improves some security queries. The improvements are:
43-
- Track flow through functions that combine taint tracking with flow through fields.
44-
- Track flow through clone-like functions, that is, functions that read contents of a field from a
45-
parameter and stores the value in the field of a returned object.
49+
- Track flow through functions that combine taint tracking with flow through fields.
50+
- Track flow through clone-like functions, that is, functions that read contents of a field from a
51+
parameter and stores the value in the field of a returned object.
4652
* The security pack taint tracking library
4753
(`semmle.code.cpp.security.TaintTracking`) uses a new intermediate
4854
representation. This provides a more precise analysis of flow through
@@ -52,28 +58,27 @@ The following changes in version 1.24 affect C/C++ analysis in all applications.
5258
(`semmle.code.cpp.valuenumbering.GlobalValueNumbering`) uses a new
5359
intermediate representation to provide a more precise analysis of
5460
heap-allocated memory and pointers to stack variables.
55-
* Created the `semmle.code.cpp.models.interfaces.Allocation` library to model
56-
allocation such as `new` expressions and calls to `malloc`. This in intended
57-
to replace the functionality in `semmle.code.cpp.commons.Alloc` with a more
58-
consistent and useful interface.
59-
* The predicate `freeCall` in `semmle.code.cpp.commons.Alloc` has been
60-
deprecated. The`Allocation` and `Deallocation` models in
61-
`semmle.code.cpp.models.interfaces` should be used instead.
62-
* Created the `semmle.code.cpp.models.interfaces.Deallocation` library to
63-
model deallocation such as `delete` expressions and calls to `free`. This
64-
in intended to replace the functionality in `semmle.code.cpp.commons.Alloc`
65-
with a more consistent and useful interface.
61+
* New libraries have been created to provide a more consistent and useful interface
62+
for modeling allocation and deallocation. These replace the old
63+
`semmle.code.cpp.commons.Alloc` library.
64+
* The new `semmle.code.cpp.models.interfaces.Allocation` library models
65+
allocations, such as `new` expressions and calls to `malloc`.
66+
* The new `semmle.code.cpp.models.interfaces.Deallocation` library
67+
models deallocations, such as `delete` expressions and calls to `free`.
68+
* The predicate `freeCall` in `semmle.code.cpp.commons.Alloc` has been
69+
deprecated. The `Allocation` and `Deallocation` models in
70+
`semmle.code.cpp.models.interfaces` should be used instead.
6671
* The new class `StackVariable` should be used in place of `LocalScopeVariable`
6772
in most cases. The difference is that `StackVariable` does not include
6873
variables declared with `static` or `thread_local`.
69-
* As a rule of thumb, custom queries about the _values_ of variables should
70-
be changed from `LocalScopeVariable` to `StackVariable`, while queries
71-
about the _name or scope_ of variables should remain unchanged.
72-
* The `LocalScopeVariableReachability` library is deprecated in favor of
73-
`StackVariableReachability`. The functionality is the same.
74+
* As a rule of thumb, custom queries about the _values_ of variables should
75+
be changed from `LocalScopeVariable` to `StackVariable`, while queries
76+
about the _name or scope_ of variables should remain unchanged.
77+
* The `LocalScopeVariableReachability` library is deprecated in favor of
78+
`StackVariableReachability`. The functionality is the same.
7479
* Taint tracking and data flow now features better modeling of commonly-used
7580
library functions:
76-
* `gets` and similar functions,
77-
* the most common operations on `std::string`,
78-
* `strdup` and similar functions, and
79-
* formatting functions such as `sprintf`.
81+
* `gets` and similar functions,
82+
* the most common operations on `std::string`,
83+
* `strdup` and similar functions, and
84+
* formatting functions such as `sprintf`.

0 commit comments

Comments
 (0)