|
|
@ -365,15 +365,28 @@ let java_unchecked_exn_desc proc_name exn_name pre_str : error_desc =
|
|
|
|
"can throw "^(Mangled.to_string exn_name);
|
|
|
|
"can throw "^(Mangled.to_string exn_name);
|
|
|
|
"whenever "^pre_str], None, [])
|
|
|
|
"whenever "^pre_str], None, [])
|
|
|
|
|
|
|
|
|
|
|
|
let desc_activity_leak pname activity_typ fieldname : error_desc =
|
|
|
|
let desc_activity_leak pname activity_typ fieldname leak_path : 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" in
|
|
|
|
|
|
|
|
let fld_str = Ident.fieldname_to_string fieldname in
|
|
|
|
let fld_str = Ident.fieldname_to_string fieldname in
|
|
|
|
let leak_msg =
|
|
|
|
let leak_root =
|
|
|
|
if fld_str = "android.os.Handler.sFakeHandlerQueue" then "call to Handler.postDelayed"
|
|
|
|
if fld_str = "android.os.Handler.sFakeHandlerQueue"
|
|
|
|
else "assignment to static field " ^ fld_str in
|
|
|
|
then " runnable passed to Handler.postDelayed |->\n "
|
|
|
|
(["Activity"; activity_str; leak_msg; "during call to"; pname_str] , None, [])
|
|
|
|
else " static field " ^ fld_str ^ " |->\n " in
|
|
|
|
|
|
|
|
let leak_path_entry_to_str acc entry =
|
|
|
|
|
|
|
|
let entry_str = match entry with
|
|
|
|
|
|
|
|
| (Some fld, _) -> Ident.fieldname_to_string fld
|
|
|
|
|
|
|
|
| (None, typ) -> Sil.typ_to_string typ in
|
|
|
|
|
|
|
|
(* intentionally omit space; [typ_to_string] adds an extra space *)
|
|
|
|
|
|
|
|
acc ^ entry_str ^ " |->\n " in
|
|
|
|
|
|
|
|
let activity_str = Sil.typ_to_string activity_typ in
|
|
|
|
|
|
|
|
let path_str =
|
|
|
|
|
|
|
|
let path_prefix =
|
|
|
|
|
|
|
|
if leak_path = [] then "leaked "
|
|
|
|
|
|
|
|
else (IList.fold_left leak_path_entry_to_str "" leak_path) ^ " leaked " in
|
|
|
|
|
|
|
|
path_prefix ^ activity_str in
|
|
|
|
|
|
|
|
let preamble =
|
|
|
|
|
|
|
|
let pname_str = Procname.java_get_class pname ^ "." ^ Procname.java_get_method pname in
|
|
|
|
|
|
|
|
"Activity " ^ activity_str ^ "may leak during method" ^ pname_str ^ ":\n" in
|
|
|
|
|
|
|
|
([preamble; leak_root; path_str], None, [])
|
|
|
|
|
|
|
|
|
|
|
|
let desc_assertion_failure loc : error_desc =
|
|
|
|
let desc_assertion_failure loc : error_desc =
|
|
|
|
(["could be raised"; at_line (Tags.create ()) loc], None, [])
|
|
|
|
(["could be raised"; at_line (Tags.create ()) loc], None, [])
|
|
|
|