FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
codeql/cpp/ql/src/Critical/InitialisationNotRun.ql at codeql-cli/latest · github/codeql · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
github
/
codeql
Public
Notifications
You must be signed in to change notification settings
Fork
2.1k
Star
10k
Code
Issues
998
Pull requests
460
Discussions
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
codeql
/
cpp
/
ql
/
src
/
Critical
/
InitialisationNotRun.ql
Copy path
More file actions
More file actions
Latest commit
History
History
History
52 lines (46 loc) · 1.22 KB
Breadcrumbs
codeql
/
cpp
/
ql
/
src
/
Critical
/
InitialisationNotRun.ql
Copy path
File metadata and controls
52 lines (46 loc) · 1.22 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/**
* @name Initialization code not run
* @description Not running initialization code may lead to unexpected behavior.
* @kind problem
* @id cpp/initialization-not-run
* @problem.severity warning
* @security-severity 7.5
* @tags reliability
* security
* external/cwe/cwe-456
*/
import
cpp
import
semmle.code.cpp.pointsto.CallGraph
predicate
global
(
GlobalVariable
v
)
{
not
exists
(
v
.
getInitializer
(
)
)
and
not
v
.
getType
(
)
instanceof
ArrayType
and
not
v
.
getType
(
)
instanceof
Class
and
v
.
getAnAccess
(
)
.
isUsedAsLValue
(
)
}
predicate
mainCalled
(
Function
f
)
{
f
.
hasGlobalName
(
"main"
)
or
exists
(
Function
caller
|
mainCalled
(
caller
)
and
allCalls
(
caller
,
f
)
)
}
predicate
called
(
Function
f
)
{
mainCalled
(
f
)
or
exists
(
FunctionAccess
fa
|
fa
.
getTarget
(
)
=
f
)
}
predicate
staticWithoutDereference
(
GlobalVariable
v
)
{
v
.
isStatic
(
)
and
not
exists
(
VariableAccess
va
|
va
=
v
.
getAnAccess
(
)
and
dereferenced
(
va
)
)
}
from
GlobalVariable
v
where
global
(
v
)
and
not
staticWithoutDereference
(
v
)
and
not
exists
(
VariableAccess
lval
|
v
.
getAnAccess
(
)
=
lval
and
lval
.
isUsedAsLValue
(
)
and
called
(
lval
.
getEnclosingFunction
(
)
)
)
select
v
,
"Initialization code for '"
+
v
.
getName
(
)
+
"' is never run."
Back
|
FazBrowse Home
|
New Git URL