You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- The queries listed now find uses of the operator 'new' where there is no value initialization provided.
2
+
- The queries listed now find uses of the operator 'new' where there is no value initialization provided. The queries listed now also uses an out of the box library to consider initialization within another function as valid initialization (`InitializationFunctions.qll`). We do not yet track finely track the initialization/use of `p` vs `*p`.
Copy file name to clipboardExpand all lines: cpp/common/src/codingstandards/cpp/rules/readofuninitializedmemory/ReadOfUninitializedMemory.qll
+44-16Lines changed: 44 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -122,6 +122,10 @@ class InitializationContext extends TInitializationContext {
122
122
}
123
123
}
124
124
125
+
/**
126
+
* Catches `new int;` as an expression that doesn't initialize its value. Note that the pointer returned has been initialized (ie it is a valid pointer),
127
+
* but the pointee/value has not. In our analysis, we simply count `x` as uninitialized in `x = new int` for now, though a more thorough analysis might track the initialization of `x` and `*x` separately.
128
+
*/
125
129
classNewNotInitextendsNewExpr{
126
130
NewNotInit(){
127
131
this.getAllocatedType()instanceofBuiltInTypeand
@@ -133,10 +137,6 @@ class NonInitAssignment extends Assignment {
Copy file name to clipboardExpand all lines: rule_packages/cpp/Lifetime.json
+5-2Lines changed: 5 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,10 @@
18
18
"correctness",
19
19
"security",
20
20
"scope/system"
21
-
]
21
+
],
22
+
"implementation_scope": {
23
+
"description": "The rule currently does not track member initialization or arrays at all (that have been declared with array types when they have not been assigned via pointers)."
24
+
}
22
25
}
23
26
],
24
27
"title": "The value of an object must not be read before it has been set"
@@ -32,7 +35,7 @@
32
35
{
33
36
"description": "When storage durations are not compatible between assigned pointers it can lead to referring to objects outside of their lifetime, which is undefined behaviour.",
34
37
"kind": "problem",
35
-
"name": "Declare objects with appropriate storage durations",
38
+
"name": "Do not assign the address of an object with automatic storage to an object that may persist after it's lifetime",
0 commit comments