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
d0fbe8b2
Unverified
Commit
d0fbe8b2
authored
Jan 12, 2021
by
Enkelmann
Committed by
GitHub
Jan 12, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add GitHub actions for Rustfmt and clippy (#125)
parent
d3dde7d7
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
57 additions
and
19 deletions
+57
-19
codestyle_checks.yml
.github/workflows/codestyle_checks.yml
+40
-0
main.rs
caller/src/main.rs
+1
-1
mod.rs
cwe_checker_rs/src/analysis/pointer_inference/context/mod.rs
+1
-1
object.rs
cwe_checker_rs/src/analysis/pointer_inference/object.rs
+2
-3
mod.rs
cwe_checker_rs/src/bil/mod.rs
+1
-1
serde.rs
cwe_checker_rs/src/ffi/serde.rs
+9
-7
term.rs
cwe_checker_rs/src/intermediate_representation/term.rs
+1
-4
expressions.rs
cwe_checker_rs/src/pcode/expressions.rs
+1
-1
term.rs
cwe_checker_rs/src/pcode/term.rs
+1
-1
No files found.
.github/workflows/codestyle_checks.yml
0 → 100644
View file @
d0fbe8b2
name
:
codestyle-checks
on
:
[
push
]
env
:
CARGO_TERM_COLOR
:
always
jobs
:
fmt
:
name
:
Rustfmt
runs-on
:
ubuntu-latest
steps
:
-
uses
:
actions/checkout@v2
-
uses
:
actions-rs/toolchain@v1
with
:
profile
:
minimal
toolchain
:
stable
override
:
true
components
:
rustfmt
-
uses
:
actions-rs/cargo@v1
with
:
command
:
fmt
args
:
--all -- --check
clippy
:
name
:
Clippy
runs-on
:
ubuntu-latest
steps
:
-
uses
:
actions/checkout@v2
-
uses
:
actions-rs/toolchain@v1
with
:
profile
:
minimal
toolchain
:
stable
override
:
true
components
:
clippy
-
uses
:
actions-rs/cargo@v1
with
:
command
:
clippy
args
:
-- -D clippy::all
\ No newline at end of file
caller/src/main.rs
View file @
d0fbe8b2
...
@@ -198,7 +198,7 @@ fn filter_modules_for_partial_run(
...
@@ -198,7 +198,7 @@ fn filter_modules_for_partial_run(
.filter_map
(|
module_name
|
{
.filter_map
(|
module_name
|
{
if
let
Some
(
module
)
=
modules
.iter
()
.find
(|
module
|
module
.name
==
module_name
)
{
if
let
Some
(
module
)
=
modules
.iter
()
.find
(|
module
|
module
.name
==
module_name
)
{
Some
(
*
module
)
Some
(
*
module
)
}
else
if
module_name
==
""
{
}
else
if
module_name
.is_empty
()
{
None
None
}
else
{
}
else
{
panic!
(
"Error: {} is not a valid module name."
,
module_name
)
panic!
(
"Error: {} is not a valid module name."
,
module_name
)
...
...
cwe_checker_rs/src/analysis/pointer_inference/context/mod.rs
View file @
d0fbe8b2
...
@@ -67,7 +67,7 @@ impl<'a> Context<'a> {
...
@@ -67,7 +67,7 @@ impl<'a> Context<'a> {
}
}
/// If `result` is an `Err`, log the error message as a debug message through the `log_collector` channel.
/// If `result` is an `Err`, log the error message as a debug message through the `log_collector` channel.
pub
fn
log_debug
<
'_lt
>
(
&
self
,
result
:
Result
<
(),
Error
>
,
location
:
Option
<&
'_lt
Tid
>
)
{
pub
fn
log_debug
(
&
self
,
result
:
Result
<
(),
Error
>
,
location
:
Option
<&
Tid
>
)
{
if
let
Err
(
err
)
=
result
{
if
let
Err
(
err
)
=
result
{
let
mut
log_message
=
let
mut
log_message
=
LogMessage
::
new_debug
(
format!
(
"{}"
,
err
))
.source
(
"Pointer Inference"
);
LogMessage
::
new_debug
(
format!
(
"{}"
,
err
))
.source
(
"Pointer Inference"
);
...
...
cwe_checker_rs/src/analysis/pointer_inference/object.rs
View file @
d0fbe8b2
...
@@ -5,7 +5,6 @@ use crate::prelude::*;
...
@@ -5,7 +5,6 @@ use crate::prelude::*;
use
derive_more
::
Deref
;
use
derive_more
::
Deref
;
use
serde
::{
Deserialize
,
Serialize
};
use
serde
::{
Deserialize
,
Serialize
};
use
std
::
collections
::
BTreeSet
;
use
std
::
collections
::
BTreeSet
;
use
std
::
iter
::
FromIterator
;
use
std
::
ops
::
DerefMut
;
use
std
::
ops
::
DerefMut
;
use
std
::
sync
::
Arc
;
use
std
::
sync
::
Arc
;
...
@@ -271,9 +270,9 @@ impl AbstractObjectInfo {
...
@@ -271,9 +270,9 @@ impl AbstractObjectInfo {
.map
(|(
index
,
value
)|
(
format!
(
"{}"
,
index
),
value
.to_json_compact
()));
.map
(|(
index
,
value
)|
(
format!
(
"{}"
,
index
),
value
.to_json_compact
()));
elements
.push
((
elements
.push
((
"memory"
.to_string
(),
"memory"
.to_string
(),
serde_json
::
Value
::
Object
(
serde_json
::
Map
::
from_iter
(
memory
)),
serde_json
::
Value
::
Object
(
memory
.collect
(
)),
));
));
serde_json
::
Value
::
Object
(
serde_json
::
Map
::
from_iter
(
elements
.into_iter
()
))
serde_json
::
Value
::
Object
(
elements
.into_iter
()
.collect
(
))
}
}
}
}
...
...
cwe_checker_rs/src/bil/mod.rs
View file @
d0fbe8b2
...
@@ -343,7 +343,7 @@ impl From<Expression> for IrExpression {
...
@@ -343,7 +343,7 @@ impl From<Expression> for IrExpression {
}
else
if
width
%
8
==
0
{
}
else
if
width
%
8
==
0
{
IrExpression
::
Subpiece
{
IrExpression
::
Subpiece
{
arg
:
Box
::
new
(
IrExpression
::
from
(
*
arg
)),
arg
:
Box
::
new
(
IrExpression
::
from
(
*
arg
)),
low_byte
:
(
0
as
u64
)
.into
(),
low_byte
:
(
0u64
)
.into
(),
size
:
width
.into
(),
size
:
width
.into
(),
}
}
}
else
{
}
else
{
...
...
cwe_checker_rs/src/ffi/serde.rs
View file @
d0fbe8b2
...
@@ -21,7 +21,6 @@ external to_string: serde_json -> string = "rs_convert_json_to_string"
...
@@ -21,7 +21,6 @@ external to_string: serde_json -> string = "rs_convert_json_to_string"
use
super
::
OcamlSendable
;
use
super
::
OcamlSendable
;
use
ocaml
::{
FromValue
,
ToValue
};
use
ocaml
::{
FromValue
,
ToValue
};
use
std
::
iter
::
FromIterator
;
use
std
::
rc
::
Rc
;
use
std
::
rc
::
Rc
;
use
std
::
str
::
FromStr
;
use
std
::
str
::
FromStr
;
...
@@ -61,12 +60,15 @@ impl From<&JsonBuilder> for serde_json::Value {
...
@@ -61,12 +60,15 @@ impl From<&JsonBuilder> for serde_json::Value {
.map
(|
rc_elem
|
serde_json
::
Value
::
from
(
&**
rc_elem
))
.map
(|
rc_elem
|
serde_json
::
Value
::
from
(
&**
rc_elem
))
.collect
(),
.collect
(),
JsonBuilder
::
Object
(
tuple_vec
)
=>
serde_json
::
Value
::
Object
(
JsonBuilder
::
Object
(
tuple_vec
)
=>
serde_json
::
Value
::
Object
(
serde_json
::
Map
::
from_iter
(
tuple_vec
.iter
()
.map
(|(
string_ref
,
json_builder
)|
{
tuple_vec
(
.iter
()
string_ref
.to_string
(),
.map
(|(
string_ref
,
json_builder
)|
{
serde_json
::
Value
::
from
(
&**
json_builder
),
(
)
string_ref
.to_string
(),
})),
serde_json
::
Value
::
from
(
&**
json_builder
),
)
})
.collect
(),
),
),
}
}
}
}
...
...
cwe_checker_rs/src/intermediate_representation/term.rs
View file @
d0fbe8b2
...
@@ -288,10 +288,7 @@ impl ExternSymbol {
...
@@ -288,10 +288,7 @@ impl ExternSymbol {
/// Get the calling convention corresponding to the extern symbol.
/// Get the calling convention corresponding to the extern symbol.
pub
fn
get_calling_convention
<
'a
>
(
&
self
,
project
:
&
'a
Project
)
->
&
'a
CallingConvention
{
pub
fn
get_calling_convention
<
'a
>
(
&
self
,
project
:
&
'a
Project
)
->
&
'a
CallingConvention
{
let
cconv_name
=
match
self
.calling_convention
{
let
cconv_name
:
&
str
=
self
.calling_convention
.as_deref
()
.unwrap_or
(
"default"
);
Some
(
ref
name
)
=>
name
,
None
=>
"default"
,
};
project
project
.calling_conventions
.calling_conventions
.iter
()
.iter
()
...
...
cwe_checker_rs/src/pcode/expressions.rs
View file @
d0fbe8b2
...
@@ -94,7 +94,7 @@ impl Variable {
...
@@ -94,7 +94,7 @@ impl Variable {
input0
:
None
,
input0
:
None
,
input1
:
Some
(
Variable
::
new_const
(
input1
:
Some
(
Variable
::
new_const
(
self
.address
.as_ref
()
.unwrap
(),
self
.address
.as_ref
()
.unwrap
(),
ByteSize
::
from
(
0
as
u64
),
// We do not know the correct pointer size here.
ByteSize
::
from
(
0u64
),
// We do not know the correct pointer size here.
)),
)),
input2
:
None
,
input2
:
None
,
},
},
...
...
cwe_checker_rs/src/pcode/term.rs
View file @
d0fbe8b2
...
@@ -175,7 +175,7 @@ impl Def {
...
@@ -175,7 +175,7 @@ impl Def {
pub
fn
correct_pointer_sizes
(
&
mut
self
,
pointer_size
:
ByteSize
)
{
pub
fn
correct_pointer_sizes
(
&
mut
self
,
pointer_size
:
ByteSize
)
{
if
self
.rhs.mnemonic
==
ExpressionType
::
LOAD
{
if
self
.rhs.mnemonic
==
ExpressionType
::
LOAD
{
let
input1
=
self
.rhs.input1
.as_mut
()
.unwrap
();
let
input1
=
self
.rhs.input1
.as_mut
()
.unwrap
();
if
input1
.size
==
ByteSize
::
from
(
0
as
u64
)
{
if
input1
.size
==
ByteSize
::
from
(
0u64
)
{
input1
.size
=
pointer_size
;
input1
.size
=
pointer_size
;
}
}
}
}
...
...
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