[Infer][activity leaks] Turning on Activity leak reporting

Summary:
Making Activity leak error messages production-ready
and turning off filtering of leak alarms.
master
Sam Blackshear 9 years ago
parent e127255f60
commit 485d5c030e

@ -250,7 +250,8 @@ def should_report(analyzer, row):
'RESOURCE_LEAK',
'MEMORY_LEAK',
'RETAIN_CYCLE',
'ASSERTION_FAILURE'
'ASSERTION_FAILURE',
'ACTIVITY_LEAK'
]
if analyzer in [ERADICATE, CHECKERS, TRACING]:

@ -27,8 +27,8 @@ let hpred_is_open_resource prop = function
None
(** Produce a description of a persistent reference to an Android Activity *)
let explain_activity_leak activity_typ fieldname =
Localise.desc_activity_leak activity_typ fieldname
let explain_activity_leak pname activity_typ fieldname =
Localise.desc_activity_leak pname activity_typ fieldname
(** Explain a deallocate stack variable error *)
let explain_deallocate_stack_var pvar ra =

@ -41,7 +41,7 @@ val find_boolean_assignment : Cfg.Node.t -> Sil.pvar -> bool -> Cfg.Node.t optio
val exp_rv_dexp : Cfg.Node.t -> Sil.exp -> Sil.dexp option
(** Produce a description of a persistent reference to an Android Activity *)
val explain_activity_leak : Sil.typ -> Ident.fieldname -> Localise.error_desc
val explain_activity_leak : Procname.t -> Sil.typ -> Ident.fieldname -> Localise.error_desc
(** Produce a description of a mismatch between an allocation function and a deallocation function *)
val explain_allocation_mismatch : Sil.res_action -> Sil.res_action -> Localise.error_desc

@ -591,7 +591,7 @@ let forward_tabulate cfg tenv =
L.d_strln ".... Work list empty. Stop ...."; L.d_ln ()
(** report an error if any Activity is reachable from a static field *)
let report_activity_leaks sigma tenv =
let report_activity_leaks pname sigma tenv =
(* report an error if an expression in [activity_exps] is reachable from [field_strexp] *)
let check_reachable_activity_from_fld (fld_name, fld_strexp) activity_exps =
let _, reachable_exps =
@ -601,7 +601,7 @@ let report_activity_leaks sigma tenv =
list_iter
(fun (activity_exp, typ) ->
if Sil.ExpSet.mem activity_exp reachable_exps then
let err_desc = Errdesc.explain_activity_leak typ fld_name in
let err_desc = Errdesc.explain_activity_leak pname typ fld_name in
raise (Exceptions.Activity_leak (err_desc, try assert false with Assert_failure x -> x)))
activity_exps in
(* get the set of pointed-to expressions of type T <: Activity *)
@ -680,7 +680,7 @@ let extract_specs tenv pdesc pathset : Prop.normal Specs.spec list =
(* let () = L.out "@.AFTER abs:@.$%a@." (Prop.pp_prop Utils.pe_text) prop'' in *)
let pre, post = Prop.extract_spec prop'' in
let pre' = Prop.normalize (Prop.prop_sub sub pre) in
if !Sil.curr_language = Sil.Java then report_activity_leaks (Prop.get_sigma post) tenv;
if !Sil.curr_language = Sil.Java then report_activity_leaks pname (Prop.get_sigma post) tenv;
let post' =
if Prover.check_inconsistency_base prop then None
else Some (Prop.normalize (Prop.prop_sub sub post), path) in

@ -364,10 +364,12 @@ let java_unchecked_exn_desc proc_name exn_name pre_str : error_desc =
"can throw "^(Mangled.to_string exn_name);
"whenever "^pre_str], None, [])
let desc_activity_leak activity_typ fieldname : error_desc =
let activity_str = Sil.typ_to_string activity_typ in
let desc_activity_leak pname activity_typ fieldname : error_desc =
let pname_str = Procname.java_get_class pname ^ "." ^ Procname.java_get_method pname in
(* intentionally omit space; [typ_to_string] adds an extra space *)
let activity_str = Sil.typ_to_string activity_typ ^ "may leak via static field" in
let fld_str = Ident.fieldname_to_string fieldname in
(["Activity subclass"; activity_str; "may leak via static field"; fld_str], None, [])
(["Activity"; activity_str; fld_str; "during call to"; pname_str], None, [])
let desc_assertion_failure loc : error_desc =
(["could be raised"; at_line (Tags.create ()) loc], None, [])

@ -190,7 +190,7 @@ val desc_null_test_after_dereference : string -> int -> Sil.location -> error_de
val java_unchecked_exn_desc : Procname.t -> Mangled.t -> string -> error_desc
val desc_activity_leak : Sil.typ -> Ident.fieldname -> error_desc
val desc_activity_leak : Procname.t -> Sil.typ -> Ident.fieldname -> error_desc
(* Create human-readable error description for assertion failures *)
val desc_assertion_failure : Sil.location -> error_desc

Loading…
Cancel
Save