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
060884e9
Unverified
Commit
060884e9
authored
Jun 15, 2022
by
Enkelmann
Committed by
GitHub
Jun 15, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix control flow for sequences of conditional assignments (#337)
parent
5621a04c
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
18 additions
and
6 deletions
+18
-6
CHANGES.md
CHANGES.md
+3
-0
Cargo.lock
Cargo.lock
+2
-2
Cargo.toml
src/caller/Cargo.toml
+1
-1
Cargo.toml
src/cwe_checker_lib/Cargo.toml
+1
-1
project.rs
...we_checker_lib/src/intermediate_representation/project.rs
+11
-2
propagate_control_flow.rs
...rmediate_representation/project/propagate_control_flow.rs
+0
-0
No files found.
CHANGES.md
View file @
060884e9
0.7-dev
====
0.
6 (2022-06)
====
...
...
Cargo.lock
View file @
060884e9
...
...
@@ -128,7 +128,7 @@ dependencies = [
[[package]]
name = "cwe_checker"
version = "0.
6.0
"
version = "0.
7.0-dev
"
dependencies = [
"cwe_checker_lib",
"directories",
...
...
@@ -151,7 +151,7 @@ dependencies = [
[[package]]
name = "cwe_checker_lib"
version = "0.
6.0
"
version = "0.
7.0-dev
"
dependencies = [
"anyhow",
"apint",
...
...
src/caller/Cargo.toml
View file @
060884e9
[package]
name
=
"cwe_checker"
version
=
"0.
6.0
"
version
=
"0.
7.0-dev
"
authors
=
[
"Nils-Edvin Enkelmann <nils-edvin.enkelmann@fkie.fraunhofer.de>"
]
edition
=
"2021"
...
...
src/cwe_checker_lib/Cargo.toml
View file @
060884e9
[package]
name
=
"cwe_checker_lib"
version
=
"0.
6.0
"
version
=
"0.
7.0-dev
"
authors
=
[
"Nils-Edvin Enkelmann <nils-edvin.enkelmann@fkie.fraunhofer.de>"
]
edition
=
"2021"
...
...
src/cwe_checker_lib/src/intermediate_representation/project.rs
View file @
060884e9
use
super
::
*
;
use
crate
::
utils
::
log
::
LogMessage
;
use
std
::
collections
::{
BTreeMap
,
BTreeSet
,
HashMap
,
HashSet
};
/// Contains implementation of the block duplication normalization pass.
mod
block_duplication_normalization
;
use
crate
::
utils
::
log
::
LogMessage
;
use
block_duplication_normalization
::
*
;
/// Contains implementation of the propagate control flow normalization pass.
mod
propagate_control_flow
;
use
propagate_control_flow
::
*
;
/// The `Project` struct is the main data structure representing a binary.
///
...
...
@@ -225,7 +230,10 @@ impl Project {
/// - Duplicate blocks so that if a block is contained in several functions, each function gets its own unique copy.
/// - Propagate input expressions along variable assignments.
/// - Replace trivial expressions like `a XOR a` with their result.
/// - Remove dead register assignments
/// - Remove dead register assignments.
/// - Propagate the control flow along chains of conditionals with the same condition.
/// - Substitute bitwise `AND` and `OR` operations with the stack pointer
/// in cases where the result is known due to known stack pointer alignment.
#[must_use]
pub
fn
normalize
(
&
mut
self
)
->
Vec
<
LogMessage
>
{
let
mut
logs
=
...
...
@@ -234,6 +242,7 @@ impl Project {
self
.propagate_input_expressions
();
self
.substitute_trivial_expressions
();
crate
::
analysis
::
dead_variable_elimination
::
remove_dead_var_assignments
(
self
);
propagate_control_flow
(
self
);
logs
.append
(
crate
::
analysis
::
stack_alignment_substitution
::
substitute_and_on_stackpointer
(
self
)
.unwrap_or_default
()
...
...
src/cwe_checker_lib/src/intermediate_representation/project/propagate_control_flow.rs
0 → 100644
View file @
060884e9
This diff is collapsed.
Click to expand it.
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