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