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
17022fdb
Unverified
Commit
17022fdb
authored
Nov 11, 2020
by
Melvin Klimke
Committed by
GitHub
Nov 11, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix pointer to external function (#101)
parent
a3a73e8d
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
20 additions
and
12 deletions
+20
-12
tests.rs
...hecker_rs/src/analysis/pointer_inference/context/tests.rs
+1
-0
tests.rs
cwe_checker_rs/src/analysis/pointer_inference/state/tests.rs
+1
-0
term.rs
cwe_checker_rs/src/intermediate_representation/term.rs
+2
-0
term.rs
cwe_checker_rs/src/pcode/term.rs
+5
-2
symbol.rs
cwe_checker_rs/src/term/symbol.rs
+1
-0
PcodeExtractor.java
ghidra/p_code_extractor/PcodeExtractor.java
+0
-0
ExternSymbol.java
ghidra/p_code_extractor/symbol/ExternSymbol.java
+9
-8
Program.java
ghidra/p_code_extractor/term/Program.java
+1
-2
No files found.
cwe_checker_rs/src/analysis/pointer_inference/context/tests.rs
View file @
17022fdb
...
...
@@ -15,6 +15,7 @@ fn mock_extern_symbol(name: &str) -> ExternSymbol {
let
arg
=
Arg
::
Register
(
register
(
"RDX"
));
ExternSymbol
{
tid
:
Tid
::
new
(
"extern_"
.to_string
()
+
name
),
addresses
:
vec!
[],
name
:
name
.into
(),
calling_convention
:
None
,
parameters
:
vec!
[
arg
.clone
()],
...
...
cwe_checker_rs/src/analysis/pointer_inference/state/tests.rs
View file @
17022fdb
...
...
@@ -276,6 +276,7 @@ fn clear_parameters_on_the_stack_on_extern_calls() {
};
let
extern_symbol
=
ExternSymbol
{
tid
:
Tid
::
new
(
"symbol"
),
addresses
:
vec!
[],
name
:
"my_extern_symbol"
.into
(),
calling_convention
:
None
,
parameters
:
vec!
[
stack_param
],
...
...
cwe_checker_rs/src/intermediate_representation/term.rs
View file @
17022fdb
...
...
@@ -217,6 +217,8 @@ pub enum Arg {
#[derive(Serialize,
Deserialize,
Debug,
PartialEq,
Eq,
Hash,
Clone)]
pub
struct
ExternSymbol
{
pub
tid
:
Tid
,
/// Addresses of possibly multiple locations of the same extern symbol
pub
addresses
:
Vec
<
String
>
,
/// The name of the extern symbol
pub
name
:
String
,
/// The calling convention used for the extern symbol if known
...
...
cwe_checker_rs/src/pcode/term.rs
View file @
17022fdb
...
...
@@ -294,7 +294,7 @@ impl From<Sub> for IrSub {
#[derive(Serialize,
Deserialize,
Debug,
PartialEq,
Eq,
Hash,
Clone)]
pub
struct
ExternSymbol
{
pub
tid
:
Tid
,
pub
address
:
String
,
pub
address
es
:
Vec
<
String
>
,
pub
name
:
String
,
pub
calling_convention
:
Option
<
String
>
,
pub
arguments
:
Vec
<
Arg
>
,
...
...
@@ -337,6 +337,7 @@ impl From<ExternSymbol> for IrExternSymbol {
}
IrExternSymbol
{
tid
:
symbol
.tid
,
addresses
:
symbol
.addresses
,
name
:
symbol
.name
,
calling_convention
:
symbol
.calling_convention
,
parameters
,
...
...
@@ -655,7 +656,9 @@ mod tests {
"
id
": "
sub_08048410
",
"
address
": "
08048410
"
},
"
address
": "
08048410
",
"
addresses
": [
"
08048410
"
],
"
name
": "
atoi
",
"
calling_convention
": "
__cdecl
",
"
arguments
": [
...
...
cwe_checker_rs/src/term/symbol.rs
View file @
17022fdb
...
...
@@ -76,6 +76,7 @@ impl From<ExternSymbol> for IrExternSymbol {
}
IrExternSymbol
{
tid
:
symbol
.tid
,
addresses
:
vec!
[
symbol
.address
],
name
:
symbol
.name
,
calling_convention
:
None
,
// We do not parse more than one calling convention from BAP at the moment. So we assume everything uses the standard one.
parameters
,
...
...
ghidra/p_code_extractor/PcodeExtractor.java
View file @
17022fdb
This diff is collapsed.
Click to expand it.
ghidra/p_code_extractor/symbol/ExternSymbol.java
View file @
17022fdb
...
...
@@ -11,8 +11,8 @@ public class ExternSymbol {
@SerializedName
(
"tid"
)
private
Tid
tid
;
@SerializedName
(
"address"
)
private
String
addres
s
;
@SerializedName
(
"address
es
"
)
private
ArrayList
<
String
>
addresse
s
;
@SerializedName
(
"name"
)
private
String
name
;
@SerializedName
(
"calling_convention"
)
...
...
@@ -23,11 +23,12 @@ public class ExternSymbol {
private
Boolean
noReturn
;
public
ExternSymbol
()
{
this
.
setAddresses
(
new
ArrayList
<
String
>());
}
public
ExternSymbol
(
Tid
tid
,
String
addres
s
,
String
name
,
String
callingConvention
,
ArrayList
<
Arg
>
arguments
,
Boolean
noReturn
)
{
public
ExternSymbol
(
Tid
tid
,
ArrayList
<
String
>
addresse
s
,
String
name
,
String
callingConvention
,
ArrayList
<
Arg
>
arguments
,
Boolean
noReturn
)
{
this
.
setTid
(
tid
);
this
.
setAddress
(
addres
s
);
this
.
setAddress
es
(
addresse
s
);
this
.
setName
(
name
);
this
.
setCallingConvention
(
callingConvention
);
this
.
setArguments
(
arguments
);
...
...
@@ -42,12 +43,12 @@ public class ExternSymbol {
this
.
tid
=
tid
;
}
public
String
getAddres
s
()
{
return
address
;
public
ArrayList
<
String
>
getAddresse
s
()
{
return
address
es
;
}
public
void
setAddress
(
String
addres
s
)
{
this
.
address
=
addres
s
;
public
void
setAddress
es
(
ArrayList
<
String
>
addresse
s
)
{
this
.
address
es
=
addresse
s
;
}
public
String
getName
()
{
...
...
ghidra/p_code_extractor/term/Program.java
View file @
17022fdb
...
...
@@ -22,9 +22,8 @@ public class Program {
this
.
setSubs
(
subs
);
}
public
Program
(
ArrayList
<
Term
<
Sub
>>
subs
,
ArrayList
<
ExternSymbol
>
externSymbols
,
ArrayList
<
Tid
>
entryPoints
)
{
public
Program
(
ArrayList
<
Term
<
Sub
>>
subs
,
ArrayList
<
Tid
>
entryPoints
)
{
this
.
setSubs
(
subs
);
this
.
setExternSymbols
(
externSymbols
);
this
.
setEntryPoints
(
entryPoints
);
}
...
...
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