@ -9,6 +9,7 @@
open ! IStd
open ! AbstractDomain . Types
module BoSummary = BufferOverrunAnalysisSummary
module BoUtils = BufferOverrunUtils
module CFG = BufferOverrunAnalysis . CFG
module Dom = BufferOverrunDomain
@ -256,6 +257,7 @@ type get_checks_summary = Procname.t -> checks_summary option
let check_instr :
get_checks_summary
-> BoSummary . get_summary
-> BoUtils . get_formals
-> Procname . t
-> Tenv . t
@ -265,7 +267,8 @@ let check_instr :
-> Dom . Mem . t
-> PO . ConditionSet . checked_t
-> PO . ConditionSet . checked_t =
fun get_checks_summary get_formals pname tenv integer_type_widths node instr mem cond_set ->
fun get_checks_summary get_summary get_formals pname tenv integer_type_widths node instr mem
cond_set ->
match instr with
| Sil . Load { e = exp ; loc = location } ->
cond_set
@ -291,6 +294,7 @@ let check_instr :
let model_env =
let node_hash = CFG . Node . hash node in
BoUtils . ModelEnv . mk_model_env pname ~ node_hash location tenv integer_type_widths
get_summary
in
check model_env mem cond_set
| None -> (
@ -322,6 +326,7 @@ let print_debug_info : Sil.instr -> Dom.Mem.t -> PO.ConditionSet.checked_t -> un
let check_instrs :
get_checks_summary
-> BoSummary . get_summary
-> BoUtils . get_formals
-> Procname . t
-> Tenv . t
@ -332,7 +337,8 @@ let check_instrs :
-> Dom . Mem . t AbstractInterpreter . State . t
-> Checks . t
-> Checks . t =
fun get_checks_summary get_formals pname tenv integer_type_widths cfg node instrs state checks ->
fun get_checks_summary get_summary get_formals pname tenv integer_type_widths cfg node instrs state
checks ->
match state with
| _ when Instrs . is_empty instrs ->
checks
@ -349,8 +355,8 @@ let check_instrs :
checks
in
let cond_set =
check_instr get_checks_summary get_ formals pname tenv integer_type_widths node instr pre
checks. cond_set
check_instr get_checks_summary get_ summary get_ formals pname tenv integer_type_widths node
instr pre checks. cond_set
in
print_debug_info instr pre cond_set ;
{ checks with cond_set }
@ -358,6 +364,7 @@ let check_instrs :
let check_node :
get_checks_summary
-> BoSummary . get_summary
-> BoUtils . get_formals
-> Procname . t
-> Tenv . t
@ -367,12 +374,13 @@ let check_node :
-> Checks . t
-> CFG . Node . t
-> Checks . t =
fun get_checks_summary get_formals pname tenv integer_type_widths cfg inv_map checks node ->
fun get_checks_summary get_summary get_formals pname tenv integer_type_widths cfg inv_map checks
node ->
match BufferOverrunAnalysis . extract_state ( CFG . Node . id node ) inv_map with
| Some state ->
let instrs = CFG . instrs node in
check_instrs get_checks_summary get_ formals pname tenv integer_type_widths cfg node instrs
state checks
check_instrs get_checks_summary get_ summary get_ formals pname tenv integer_type_widths cfg
node instrs state checks
| _ ->
checks
@ -381,6 +389,7 @@ type checks = Checks.t
let compute_checks :
get_checks_summary
-> BoSummary . get_summary
-> BoUtils . get_formals
-> Procname . t
-> Tenv . t
@ -388,9 +397,11 @@ let compute_checks :
-> CFG . t
-> BufferOverrunAnalysis . invariant_map
-> checks =
fun get_checks_summary get_ formals pname tenv integer_type_widths cfg inv_map ->
fun get_checks_summary get_ summary get_ formals pname tenv integer_type_widths cfg inv_map ->
CFG . fold_nodes cfg
~ f : ( check_node get_checks_summary get_formals pname tenv integer_type_widths cfg inv_map )
~ f :
( check_node get_checks_summary get_summary get_formals pname tenv integer_type_widths cfg
inv_map )
~ init : Checks . empty
@ -433,14 +444,24 @@ let checker ({InterproceduralAnalysis.proc_desc; tenv; exe_env; analyze_dependen
AnalysisCallbacks . html_debug_new_node_session ~ pp_name underlying_exit_node ~ f : ( fun () ->
let cfg = CFG . from_pdesc proc_desc in
let checks =
let open IOption . Let_syntax in
let get_summary_common callee_pname =
let + _ , summaries = analyze_dependency callee_pname in
summaries
in
let get_checks_summary callee_pname =
analyze_dependency callee_pname
| > Option . bind ~ f : ( fun ( _ , ( checker_summary , _ analysis_summary ) ) -> checker_summary )
let * checker_summary , _ analysis_summary = get_summary_common callee_pname in
checker_summary
in
let get_summary callee_pname =
let * _ checker_summary , analysis_summary = get_summary_common callee_pname in
analysis_summary
in
let get_formals callee_pname =
AnalysisCallbacks . get_proc_desc callee_pname | > Option . map ~ f : Procdesc . get_pvar_formals
AnalysisCallbacks . get_proc_desc callee_pname >> | Procdesc . get_pvar_formals
in
compute_checks get_checks_summary get_formals proc_name tenv integer_type_widths cfg inv_map
compute_checks get_checks_summary get_summary get_formals proc_name tenv integer_type_widths
cfg inv_map
in
report_errors analysis_data checks ;
Some ( get_checks_summary checks ) )