-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
* Removes old version of log_utils, prototypes for new version. * Implemented native logging * Json-Output basically working. * Added acceptance test for JSON parsing * Adds some odoc to log_utils. * Added support for file output (--cwe-checker-out) * Add acceptance test for file output
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
open Core_kernel | ||
open Bap.Std | ||
open Symbol_utils | ||
open Log_utils | ||
|
||
let name = "CWE190" | ||
let version = "0.1" | ||
|
@@ -20,12 +21,11 @@ let contains_multiplication d = | |
let check_multiplication_before_symbol _proj _prog _sub blk jmp tid_map symbols = | ||
Seq.iter (Term.enum def_t blk) | ||
~f:(fun d -> if contains_multiplication d then | ||
Log_utils.warn | ||
"[%s] {%s} (Integer Overflow or Wraparound) Potential overflow due to multiplication %s (%s)." | ||
name | ||
version | ||
(Address_translation.translate_tid_to_assembler_address_string (Term.tid blk) tid_map) | ||
(Symbol_utils.get_symbol_name_from_jmp jmp symbols)) | ||
let description = "(Integer Overflow or Wraparound) Potential overflow due to multiplication" in | ||
This comment has been minimized.
Sorry, something went wrong.
Enkelmann
Contributor
|
||
let addresses = [(Address_translation.translate_tid_to_assembler_address_string (Term.tid blk) tid_map)] in | ||
let symbols = [(Symbol_utils.get_symbol_name_from_jmp jmp symbols)] in | ||
let cwe_warning = cwe_warning_factory name version description ~addresses ~symbols in | ||
collect_cwe_warning cwe_warning) | ||
|
||
let check_cwe prog proj tid_map symbol_names _ = | ||
match symbol_names with | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
open Core_kernel | ||
|
||
open Symbol_utils | ||
open Log_utils | ||
|
||
let name = "CWE332" | ||
let version = "0.1" | ||
|
@@ -10,6 +10,10 @@ let check_cwe program _proj _tid_map _symbol_pairs _ = | |
| None -> begin | ||
match (find_symbol program "rand") with | ||
| None -> () | ||
| Some _ -> Log_utils.warn "[%s] {%s} (Insufficient Entropy in PRNG) program uses rand without calling srand before" name version | ||
| Some _ -> begin | ||
let description = "(Insufficient Entropy in PRNG) program uses rand without calling srand before" in | ||
let cwe_warning = cwe_warning_factory name version description in | ||
This comment has been minimized.
Sorry, something went wrong.
Enkelmann
Contributor
|
||
collect_cwe_warning cwe_warning | ||
end | ||
end | ||
| Some (_srand_tid, _rand_tid) -> () |
1 comment
on commit 1d9991f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks nice! I think some more documentation for the users of log_utils.ml would be nice, but that may be redundant when we write the documentation for all command line options.
The package name is
ppx_deriving_yojson
.