Skip to content

Commit 6f60a52

Browse files
committed
Bring several memory queries+libraries into public repo.
1 parent a303afd commit 6f60a52

20 files changed

Lines changed: 2828 additions & 90 deletions
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/**
2+
* @id cpp/likely-bugs/memory-management/v2/conditionally-uninitialized-variable
3+
* @name Conditionally uninitialized variable
4+
* @description When an initialization function is used to initialize a local variable,
5+
* but the returned status code is not checked, reading the variable may
6+
* result in undefined behaviour.
7+
* @platform Desktop
8+
* @security.severity Low
9+
* @impact Insecure Coding Practice
10+
* @feature.area Multiple
11+
* @repro.text The following code locations potentially contain uninitialized variables
12+
* @owner.email pabrooke@microsoft.com
13+
* @kind problem
14+
* @problem.severity error
15+
* @query-version 2.0
16+
**/
17+
18+
import cpp
19+
private import UninitializedVariables
20+
21+
from ConditionallyInitializedVariable v, ConditionalInitializationFunction f, ConditionalInitializationCall call, Evidence e
22+
where exists(v.getARiskyAccess(f, call, e))
23+
and e = DefinitionInSnapshot()
24+
select call, "$@: The status of this call to $@ is not checked, potentially leaving $@ uninitialized.",
25+
call.getEnclosingFunction(),
26+
call.getEnclosingFunction().toString(),
27+
f, f.getName(),
28+
v, v.getName()

0 commit comments

Comments
 (0)