@ -375,13 +375,13 @@ let check_inherently_dangerous_function caller_pname callee_pname =
( Localise . desc_inherently_dangerous_function callee_pname ) in
( Localise . desc_inherently_dangerous_function callee_pname ) in
Reporting . log_warning caller_pname exn
Reporting . log_warning caller_pname exn
let call_should_be_skipped callee_ pname summary =
let call_should_be_skipped callee_ summary =
(* check skip flag *)
(* check skip flag *)
Specs . get_flag callee_ pname proc_flag_skip < > None
Specs . get_flag callee_ summary proc_flag_skip < > None
(* skip abstract methods *)
(* skip abstract methods *)
| | summary. Specs . attributes . ProcAttributes . is_abstract
| | callee_ summary. Specs . attributes . ProcAttributes . is_abstract
(* treat calls with no specs as skip functions in angelic mode *)
(* treat calls with no specs as skip functions in angelic mode *)
| | ( Config . angelic_execution && Specs . get_specs_from_payload summary = = [] )
| | ( Config . angelic_execution && Specs . get_specs_from_payload callee_ summary = = [] )
(* * In case of constant string dereference, return the result immediately *)
(* * In case of constant string dereference, return the result immediately *)
let check_constant_string_dereference lexp =
let check_constant_string_dereference lexp =
@ -1067,20 +1067,20 @@ let rec sym_exec tenv current_pdesc _instr (prop_: Prop.normal Prop.t) path
let exec_skip_call skipped_pname ret_annots ret_type =
let exec_skip_call skipped_pname ret_annots ret_type =
skip_call norm_prop path skipped_pname ret_annots loc ret_id
skip_call norm_prop path skipped_pname ret_annots loc ret_id
( Some ret_type ) norm_args in
( Some ret_type ) norm_args in
let resolved_pname , summary_opt = resolve_and_analyze tenv current_pdesc
let resolved_pname , resolved_ summary_opt = resolve_and_analyze tenv current_pdesc
norm_prop norm_args callee_pname call_flags in
norm_prop norm_args callee_pname call_flags in
begin
begin
match summary_opt with
match resolved_ summary_opt with
| None ->
| None ->
let ret_typ = Typ . java_proc_return_typ callee_pname_java in
let ret_typ = Typ . java_proc_return_typ callee_pname_java in
let ret_annots = load_ret_annots callee_pname in
let ret_annots = load_ret_annots callee_pname in
exec_skip_call resolved_pname ret_annots ret_typ
exec_skip_call resolved_pname ret_annots ret_typ
| Some summary when call_should_be_skipped resolved_ pname summary ->
| Some resolved_ summary when call_should_be_skipped resolved_ summary ->
let proc_attrs = summary. Specs . attributes in
let proc_attrs = resolved_ summary. Specs . attributes in
let ret_annots , _ = proc_attrs . ProcAttributes . method_annotation in
let ret_annots , _ = proc_attrs . ProcAttributes . method_annotation in
exec_skip_call resolved_pname ret_annots proc_attrs . ProcAttributes . ret_type
exec_skip_call resolved_pname ret_annots proc_attrs . ProcAttributes . ret_type
| Some summary ->
| Some resolved_ summary ->
proc_call summary ( call_args prop_ callee_pname norm_args ret_id loc )
proc_call resolved_ summary ( call_args prop_ callee_pname norm_args ret_id loc )
end
end
| Java callee_pname_java ->
| Java callee_pname_java ->
do_error_checks tenv ( Paths . Path . curr_node path ) instr current_pname current_pdesc ;
do_error_checks tenv ( Paths . Path . curr_node path ) instr current_pname current_pdesc ;
@ -1098,12 +1098,13 @@ let rec sym_exec tenv current_pdesc _instr (prop_: Prop.normal Prop.t) path
let ret_typ = Typ . java_proc_return_typ callee_pname_java in
let ret_typ = Typ . java_proc_return_typ callee_pname_java in
let ret_annots = load_ret_annots callee_pname in
let ret_annots = load_ret_annots callee_pname in
exec_skip_call ret_annots ret_typ
exec_skip_call ret_annots ret_typ
| Some summary when call_should_be_skipped pname summary ->
| Some callee_ summary when call_should_be_skipped callee_ summary ->
let proc_attrs = summary. Specs . attributes in
let proc_attrs = callee_ summary. Specs . attributes in
let ret_annots , _ = proc_attrs . ProcAttributes . method_annotation in
let ret_annots , _ = proc_attrs . ProcAttributes . method_annotation in
exec_skip_call ret_annots proc_attrs . ProcAttributes . ret_type
exec_skip_call ret_annots proc_attrs . ProcAttributes . ret_type
| Some summary ->
| Some callee_summary ->
proc_call summary ( call_args norm_prop pname url_handled_args ret_id loc ) in
let handled_args = call_args norm_prop pname url_handled_args ret_id loc in
proc_call callee_summary handled_args in
IList . fold_left ( fun acc pname -> exec_one_pname pname @ acc ) [] resolved_pnames
IList . fold_left ( fun acc pname -> exec_one_pname pname @ acc ) [] resolved_pnames
| _ -> (* Generic fun call with known name *)
| _ -> (* Generic fun call with known name *)
let ( prop_r , n_actual_params ) =
let ( prop_r , n_actual_params ) =
@ -1122,12 +1123,8 @@ let rec sym_exec tenv current_pdesc _instr (prop_: Prop.normal Prop.t) path
( call_args prop_r callee_pname actual_params ret_id loc )
( call_args prop_r callee_pname actual_params ret_id loc )
else [ ( prop_r , path ) ] in
else [ ( prop_r , path ) ] in
let do_call ( prop , path ) =
let do_call ( prop , path ) =
let summary = Specs . get_summary resolved_pname in
let resolved_summary_opt = Specs . get_summary resolved_pname in
let should_skip resolved_pname summary =
if Option . map_default call_should_be_skipped true resolved_summary_opt then
match summary with
| None -> true
| Some summary -> call_should_be_skipped resolved_pname summary in
if should_skip resolved_pname summary then
(* If it's an ObjC getter or setter, call the builtin rather than skipping *)
(* If it's an ObjC getter or setter, call the builtin rather than skipping *)
let attrs_opt =
let attrs_opt =
let attr_opt = Option . map Cfg . Procdesc . get_attributes callee_pdesc_opt in
let attr_opt = Option . map Cfg . Procdesc . get_attributes callee_pdesc_opt in
@ -1149,7 +1146,7 @@ let rec sym_exec tenv current_pdesc _instr (prop_: Prop.normal Prop.t) path
current_pdesc callee_pname loc path
current_pdesc callee_pname loc path
( sym_exec_objc_accessor objc_property_accessor ret_typ )
( sym_exec_objc_accessor objc_property_accessor ret_typ )
| None ->
| None ->
let ret_annots = match summary with
let ret_annots = match resolved_ summary_opt with
| Some summ ->
| Some summ ->
let ret_annots , _ =
let ret_annots , _ =
summ . Specs . attributes . ProcAttributes . method_annotation in
summ . Specs . attributes . ProcAttributes . method_annotation in
@ -1163,7 +1160,7 @@ let rec sym_exec tenv current_pdesc _instr (prop_: Prop.normal Prop.t) path
skip_call ~ is_objc_instance_method prop path resolved_pname ret_annots
skip_call ~ is_objc_instance_method prop path resolved_pname ret_annots
loc ret_id ret_typ_opt n_actual_params
loc ret_id ret_typ_opt n_actual_params
else
else
proc_call ( Option . get summary)
proc_call ( Option . get resolved_ summary_opt )
( call_args prop resolved_pname n_actual_params ret_id loc ) in
( call_args prop resolved_pname n_actual_params ret_id loc ) in
IList . flatten ( IList . map do_call sentinel_result )
IList . flatten ( IList . map do_call sentinel_result )
)
)
@ -1540,7 +1537,7 @@ and proc_call summary {Builtin.pdesc; tenv; prop_= pre; path; ret_id; args= actu
| _ , None -> true
| _ , None -> true
| _ , Some ( id , _ ) -> Errdesc . id_is_assigned_then_dead ( State . get_node () ) id in
| _ , Some ( id , _ ) -> Errdesc . id_is_assigned_then_dead ( State . get_node () ) id in
if is_ignored
if is_ignored
&& Specs . get_flag callee_pname proc_flag_ignore_return = None then
&& Specs . get_flag summary proc_flag_ignore_return = None then
let err_desc = Localise . desc_return_value_ignored callee_pname loc in
let err_desc = Localise . desc_return_value_ignored callee_pname loc in
let exn = ( Exceptions . Return_value_ignored ( err_desc , _ _ POS__ ) ) in
let exn = ( Exceptions . Return_value_ignored ( err_desc , _ _ POS__ ) ) in
Reporting . log_warning caller_pname exn in
Reporting . log_warning caller_pname exn in