Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cwe_checker
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fact-depend
cwe_checker
Commits
f873345f
Unverified
Commit
f873345f
authored
Aug 24, 2023
by
Enkelmann
Committed by
GitHub
Aug 24, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
optionally generate full path to "free" site in CWE-416 warnings (#423)
parent
8f3a1011
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
1 deletions
+26
-1
config.json
src/config.json
+2
-1
mod.rs
src/cwe_checker_lib/src/checkers/cwe_416/mod.rs
+0
-0
state.rs
src/cwe_checker_lib/src/checkers/cwe_416/state.rs
+24
-0
No files found.
src/config.json
View file @
f873345f
...
...
@@ -96,7 +96,8 @@
"reallocarray"
,
"operator.delete"
,
"operator.delete[]"
]
],
"always_include_full_path_to_free_site"
:
true
},
"CWE426"
:
{
"_comment"
:
"functions that change/drop privileges"
,
...
...
src/cwe_checker_lib/src/checkers/cwe_416/mod.rs
View file @
f873345f
This diff is collapsed.
Click to expand it.
src/cwe_checker_lib/src/checkers/cwe_416/state.rs
View file @
f873345f
...
...
@@ -69,6 +69,30 @@ impl State {
}
}
/// Return a list of abstract identifiers that are marked as "flagged" in the current state,
/// i.e. they already triggered the generation of a CWE warning.
pub
fn
get_already_flagged_objects
(
&
self
)
->
Vec
<
AbstractIdentifier
>
{
self
.dangling_objects
.iter
()
.filter_map
(|(
id
,
object_state
)|
match
object_state
{
ObjectState
::
AlreadyFlagged
=>
Some
(
id
.clone
()),
_
=>
None
,
})
.collect
()
}
/// Return a list of abstract identifiers that are marked as "dangling" in the current state
/// together with the TIDs of the corresponding `free` instruction.
pub
fn
get_dangling_objects
(
&
self
)
->
Vec
<
(
AbstractIdentifier
,
Tid
)
>
{
self
.dangling_objects
.iter
()
.filter_map
(|(
id
,
object_state
)|
match
object_state
{
ObjectState
::
AlreadyFlagged
=>
None
,
ObjectState
::
Dangling
(
free_id
)
=>
Some
((
id
.clone
(),
free_id
.clone
())),
})
.collect
()
}
/// Check the given address on whether it may point to already freed memory.
/// For each possible dangling pointer target the abstract ID of the object
/// and the TID of the corresponding site where the object was freed is returned.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment