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 {
...
@@ -15,6 +15,7 @@ fn mock_extern_symbol(name: &str) -> ExternSymbol {
let
arg
=
Arg
::
Register
(
register
(
"RDX"
));
let
arg
=
Arg
::
Register
(
register
(
"RDX"
));
ExternSymbol
{
ExternSymbol
{
tid
:
Tid
::
new
(
"extern_"
.to_string
()
+
name
),
tid
:
Tid
::
new
(
"extern_"
.to_string
()
+
name
),
addresses
:
vec!
[],
name
:
name
.into
(),
name
:
name
.into
(),
calling_convention
:
None
,
calling_convention
:
None
,
parameters
:
vec!
[
arg
.clone
()],
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() {
...
@@ -276,6 +276,7 @@ fn clear_parameters_on_the_stack_on_extern_calls() {
};
};
let
extern_symbol
=
ExternSymbol
{
let
extern_symbol
=
ExternSymbol
{
tid
:
Tid
::
new
(
"symbol"
),
tid
:
Tid
::
new
(
"symbol"
),
addresses
:
vec!
[],
name
:
"my_extern_symbol"
.into
(),
name
:
"my_extern_symbol"
.into
(),
calling_convention
:
None
,
calling_convention
:
None
,
parameters
:
vec!
[
stack_param
],
parameters
:
vec!
[
stack_param
],
...
...
cwe_checker_rs/src/intermediate_representation/term.rs
View file @
17022fdb
...
@@ -217,6 +217,8 @@ pub enum Arg {
...
@@ -217,6 +217,8 @@ pub enum Arg {
#[derive(Serialize,
Deserialize,
Debug,
PartialEq,
Eq,
Hash,
Clone)]
#[derive(Serialize,
Deserialize,
Debug,
PartialEq,
Eq,
Hash,
Clone)]
pub
struct
ExternSymbol
{
pub
struct
ExternSymbol
{
pub
tid
:
Tid
,
pub
tid
:
Tid
,
/// Addresses of possibly multiple locations of the same extern symbol
pub
addresses
:
Vec
<
String
>
,
/// The name of the extern symbol
/// The name of the extern symbol
pub
name
:
String
,
pub
name
:
String
,
/// The calling convention used for the extern symbol if known
/// 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 {
...
@@ -294,7 +294,7 @@ impl From<Sub> for IrSub {
#[derive(Serialize,
Deserialize,
Debug,
PartialEq,
Eq,
Hash,
Clone)]
#[derive(Serialize,
Deserialize,
Debug,
PartialEq,
Eq,
Hash,
Clone)]
pub
struct
ExternSymbol
{
pub
struct
ExternSymbol
{
pub
tid
:
Tid
,
pub
tid
:
Tid
,
pub
address
:
String
,
pub
address
es
:
Vec
<
String
>
,
pub
name
:
String
,
pub
name
:
String
,
pub
calling_convention
:
Option
<
String
>
,
pub
calling_convention
:
Option
<
String
>
,
pub
arguments
:
Vec
<
Arg
>
,
pub
arguments
:
Vec
<
Arg
>
,
...
@@ -337,6 +337,7 @@ impl From<ExternSymbol> for IrExternSymbol {
...
@@ -337,6 +337,7 @@ impl From<ExternSymbol> for IrExternSymbol {
}
}
IrExternSymbol
{
IrExternSymbol
{
tid
:
symbol
.tid
,
tid
:
symbol
.tid
,
addresses
:
symbol
.addresses
,
name
:
symbol
.name
,
name
:
symbol
.name
,
calling_convention
:
symbol
.calling_convention
,
calling_convention
:
symbol
.calling_convention
,
parameters
,
parameters
,
...
@@ -655,7 +656,9 @@ mod tests {
...
@@ -655,7 +656,9 @@ mod tests {
"
id
": "
sub_08048410
",
"
id
": "
sub_08048410
",
"
address
": "
08048410
"
"
address
": "
08048410
"
},
},
"
address
": "
08048410
",
"
addresses
": [
"
08048410
"
],
"
name
": "
atoi
",
"
name
": "
atoi
",
"
calling_convention
": "
__cdecl
",
"
calling_convention
": "
__cdecl
",
"
arguments
": [
"
arguments
": [
...
...
cwe_checker_rs/src/term/symbol.rs
View file @
17022fdb
...
@@ -76,6 +76,7 @@ impl From<ExternSymbol> for IrExternSymbol {
...
@@ -76,6 +76,7 @@ impl From<ExternSymbol> for IrExternSymbol {
}
}
IrExternSymbol
{
IrExternSymbol
{
tid
:
symbol
.tid
,
tid
:
symbol
.tid
,
addresses
:
vec!
[
symbol
.address
],
name
:
symbol
.name
,
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.
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
,
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 {
...
@@ -11,8 +11,8 @@ public class ExternSymbol {
@SerializedName
(
"tid"
)
@SerializedName
(
"tid"
)
private
Tid
tid
;
private
Tid
tid
;
@SerializedName
(
"address"
)
@SerializedName
(
"address
es
"
)
private
String
addres
s
;
private
ArrayList
<
String
>
addresse
s
;
@SerializedName
(
"name"
)
@SerializedName
(
"name"
)
private
String
name
;
private
String
name
;
@SerializedName
(
"calling_convention"
)
@SerializedName
(
"calling_convention"
)
...
@@ -23,11 +23,12 @@ public class ExternSymbol {
...
@@ -23,11 +23,12 @@ public class ExternSymbol {
private
Boolean
noReturn
;
private
Boolean
noReturn
;
public
ExternSymbol
()
{
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
.
setTid
(
tid
);
this
.
setAddress
(
addres
s
);
this
.
setAddress
es
(
addresse
s
);
this
.
setName
(
name
);
this
.
setName
(
name
);
this
.
setCallingConvention
(
callingConvention
);
this
.
setCallingConvention
(
callingConvention
);
this
.
setArguments
(
arguments
);
this
.
setArguments
(
arguments
);
...
@@ -42,12 +43,12 @@ public class ExternSymbol {
...
@@ -42,12 +43,12 @@ public class ExternSymbol {
this
.
tid
=
tid
;
this
.
tid
=
tid
;
}
}
public
String
getAddres
s
()
{
public
ArrayList
<
String
>
getAddresse
s
()
{
return
address
;
return
address
es
;
}
}
public
void
setAddress
(
String
addres
s
)
{
public
void
setAddress
es
(
ArrayList
<
String
>
addresse
s
)
{
this
.
address
=
addres
s
;
this
.
address
es
=
addresse
s
;
}
}
public
String
getName
()
{
public
String
getName
()
{
...
...
ghidra/p_code_extractor/term/Program.java
View file @
17022fdb
...
@@ -22,9 +22,8 @@ public class Program {
...
@@ -22,9 +22,8 @@ public class Program {
this
.
setSubs
(
subs
);
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
.
setSubs
(
subs
);
this
.
setExternSymbols
(
externSymbols
);
this
.
setEntryPoints
(
entryPoints
);
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