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
2e11e843
Unverified
Commit
2e11e843
authored
Sep 04, 2023
by
Enkelmann
Committed by
GitHub
Sep 04, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
always enforce expression complexity limit (#428)
parent
f82ebc5d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
14 deletions
+16
-14
mod.rs
...we_checker_lib/src/analysis/expression_propagation/mod.rs
+13
-3
tests.rs
..._checker_lib/src/analysis/expression_propagation/tests.rs
+2
-10
ParseCspecContent.java
src/ghidra/p_code_extractor/internal/ParseCspecContent.java
+1
-1
No files found.
src/cwe_checker_lib/src/analysis/expression_propagation/mod.rs
View file @
2e11e843
...
...
@@ -233,10 +233,20 @@ pub fn propagate_input_expressions(
var
,
value
:
expression
,
}
=>
{
// insert known input expressions
for
(
input_var
,
input_expr
)
in
insertable_expressions
.iter
()
{
expression
.substitute_input_var
(
input_var
,
input_expr
);
// Extend the considered expression with already known expressions.
let
mut
extended_expression
=
expression
.clone
();
for
input_var
in
expression
.input_vars
()
.into_iter
()
{
if
let
Some
(
expr
)
=
insertable_expressions
.get
(
input_var
)
{
// We limit the complexity of expressions to insert.
// This prevents extremely large expressions that can lead to extremely high RAM usage.
// FIXME: Right now this limit is quite arbitrary. Maybe there is a better way to achieve the same result?
if
expr
.recursion_depth
()
<
10
{
extended_expression
.substitute_input_var
(
input_var
,
expr
)
}
}
}
extended_expression
.substitute_trivial_operations
();
*
expression
=
extended_expression
;
// expressions dependent on the assigned variable are no longer insertable
insertable_expressions
.retain
(|
input_var
,
input_expr
|
{
input_var
!=
var
&&
!
input_expr
.input_vars
()
.into_iter
()
.any
(|
x
|
x
==
var
)
...
...
src/cwe_checker_lib/src/analysis/expression_propagation/tests.rs
View file @
2e11e843
...
...
@@ -142,11 +142,7 @@ fn inter_block_propagation() {
variable!
(
"X:8"
),
expr!
(
"-(42:4)"
)
.un_op
(
UnOpType
::
BoolNegate
),
),
Def
::
assign
(
"entry_jmp_def_2"
,
variable!
(
"Z:8"
),
expr!
(
"-(42:4)"
)
.un_op
(
UnOpType
::
IntNegate
),
)
Def
::
assign
(
"entry_jmp_def_2"
,
variable!
(
"Z:8"
),
expr!
(
"42:4"
),)
]
)
}
...
...
@@ -290,11 +286,7 @@ fn expressions_inserted() {
variable!
(
"X:8"
),
expr!
(
"-(42:4)"
)
.un_op
(
UnOpType
::
BoolNegate
),
),
Def
::
assign
(
"entry_jmp_def_2"
,
variable!
(
"Z:8"
),
expr!
(
"-(42:4)"
)
.un_op
(
UnOpType
::
IntNegate
)
)
Def
::
assign
(
"entry_jmp_def_2"
,
variable!
(
"Z:8"
),
expr!
(
"42:4"
))
]
);
assert_eq!
(
...
...
src/ghidra/p_code_extractor/internal/ParseCspecContent.java
View file @
2e11e843
...
...
@@ -165,7 +165,7 @@ public class ParseCspecContent {
String
languageId
=
program
.
getLanguageID
().
toString
();
if
(
processorDef
.
startsWith
(
"AARCH64"
)
&&
languageId
.
endsWith
(
"AppleSilicon"
))
{
processorDef
=
"AppleSilicon.ldef"
;
processorDef
=
"AppleSilicon.ldef
s
"
;
}
if
(
processorDef
.
startsWith
(
"MIPS"
)
||
processorDef
.
startsWith
(
"AVR"
))
{
processorDef
=
processorDef
.
toLowerCase
();
...
...
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