[biabduction] Delete deallocate_stack_variable and deallocate_static_memory

Summary: These issue types are unused, so let's delete them.

Reviewed By: ngorogiannis

Differential Revision: D22019490

fbshipit-source-id: 7834e04c9
master
Dulma Churchill 5 years ago committed by Facebook GitHub Bot
parent b491492796
commit 2e7848b179

@ -410,8 +410,6 @@ OPTIONS
DANGLING_POINTER_DEREFERENCE_MAYBE (disabled by default),
DEADLOCK (enabled by default),
DEAD_STORE (enabled by default),
DEALLOCATE_STACK_VARIABLE (enabled by default),
DEALLOCATE_STATIC_MEMORY (enabled by default),
DIRECT_ATOMIC_PROPERTY_ACCESS (enabled by default),
DISCOURAGED_WEAK_PROPERTY_CUSTOM_SETTER (enabled by default),
DIVIDE_BY_ZERO (disabled by default),

@ -130,8 +130,6 @@ OPTIONS
DANGLING_POINTER_DEREFERENCE_MAYBE (disabled by default),
DEADLOCK (enabled by default),
DEAD_STORE (enabled by default),
DEALLOCATE_STACK_VARIABLE (enabled by default),
DEALLOCATE_STATIC_MEMORY (enabled by default),
DIRECT_ATOMIC_PROPERTY_ACCESS (enabled by default),
DISCOURAGED_WEAK_PROPERTY_CUSTOM_SETTER (enabled by default),
DIVIDE_BY_ZERO (disabled by default),

@ -410,8 +410,6 @@ OPTIONS
DANGLING_POINTER_DEREFERENCE_MAYBE (disabled by default),
DEADLOCK (enabled by default),
DEAD_STORE (enabled by default),
DEALLOCATE_STACK_VARIABLE (enabled by default),
DEALLOCATE_STATIC_MEMORY (enabled by default),
DIRECT_ATOMIC_PROPERTY_ACCESS (enabled by default),
DISCOURAGED_WEAK_PROPERTY_CUSTOM_SETTER (enabled by default),
DIVIDE_BY_ZERO (disabled by default),

@ -424,26 +424,6 @@ let desc_condition_always_true_false i cond_str_opt loc =
{no_desc with descriptions= [description]; tags= !tags}
let desc_deallocate_stack_variable var_str proc_name loc =
let tags = Tags.create () in
Tags.update tags Tags.value var_str ;
let description =
Format.asprintf "Stack variable %a is freed by a %s" MF.pp_monospaced var_str
(call_to_at_line tags proc_name loc)
in
{no_desc with descriptions= [description]; tags= !tags}
let desc_deallocate_static_memory const_str proc_name loc =
let tags = Tags.create () in
Tags.update tags Tags.value const_str ;
let description =
Format.asprintf "Constant string %a is freed by a %s" MF.pp_monospaced const_str
(call_to_at_line tags proc_name loc)
in
{no_desc with descriptions= [description]; tags= !tags}
let desc_class_cast_exception pname_opt typ_str1 typ_str2 exp_str_opt loc =
let tags = Tags.create () in
let in_expression =

@ -105,10 +105,6 @@ val desc_class_cast_exception :
val desc_condition_always_true_false : IntLit.t -> string option -> Location.t -> error_desc
val desc_deallocate_stack_variable : string -> Procname.t -> Location.t -> error_desc
val desc_deallocate_static_memory : string -> Procname.t -> Location.t -> error_desc
val desc_divide_by_zero : string -> Location.t -> error_desc
val desc_empty_vector_access : Procname.t option -> string -> Location.t -> error_desc

@ -456,12 +456,6 @@ let deadlock =
~user_documentation:[%blob "../../documentation/issues/DEADLOCK.md"]
let deallocate_stack_variable =
register_from_string ~id:"DEALLOCATE_STACK_VARIABLE" Error Biabduction
let deallocate_static_memory = register_from_string ~id:"DEALLOCATE_STATIC_MEMORY" Error Biabduction
let _direct_atomic_property_access =
register_from_string ~id:"DIRECT_ATOMIC_PROPERTY_ACCESS" Warning Linters
~user_documentation:[%blob "../../documentation/issues/DIRECT_ATOMIC_PROPERTY_ACCESS.md"]

@ -168,10 +168,6 @@ val dead_store : t
val deadlock : t
val deallocate_stack_variable : t
val deallocate_static_memory : t
val divide_by_zero : t
val do_not_report : t

@ -37,10 +37,6 @@ exception Custom_error of string * IssueType.severity * Localise.error_desc
exception
Dangling_pointer_dereference of bool (* is it user visible? *) * Localise.error_desc * L.ocaml_pos
exception Deallocate_stack_variable of Localise.error_desc
exception Deallocate_static_memory of Localise.error_desc
exception Divide_by_zero of Localise.error_desc * L.ocaml_pos
exception Empty_vector_access of Localise.error_desc * L.ocaml_pos
@ -133,10 +129,6 @@ let recognize_exception exn : IssueToReport.t =
else IssueType.dangling_pointer_dereference_maybe
in
{issue_type; description= desc; ocaml_pos= Some ocaml_pos}
| Deallocate_stack_variable desc ->
{issue_type= IssueType.deallocate_stack_variable; description= desc; ocaml_pos= None}
| Deallocate_static_memory desc ->
{issue_type= IssueType.deallocate_static_memory; description= desc; ocaml_pos= None}
| Divide_by_zero (desc, ocaml_pos) ->
{issue_type= IssueType.divide_by_zero; description= desc; ocaml_pos= Some ocaml_pos}
| Empty_vector_access (desc, ocaml_pos) ->

@ -36,10 +36,6 @@ exception
Dangling_pointer_dereference of
bool (* is it user visible? *) * Localise.error_desc * Logging.ocaml_pos
exception Deallocate_stack_variable of Localise.error_desc
exception Deallocate_static_memory of Localise.error_desc
exception Divide_by_zero of Localise.error_desc * Logging.ocaml_pos
exception Field_not_null_checked of Localise.error_desc * Logging.ocaml_pos

@ -481,25 +481,6 @@ let check_already_dereferenced {InterproceduralAnalysis.proc_desc; err_log; tenv
()
(** Check whether symbolic execution de-allocated a stack variable or a constant string, raising an
exception in that case *)
let check_deallocate_static_memory prop_after =
let check_deallocated_attribute = function
| Predicates.Apred (Aresource ({ra_kind= Rrelease} as ra), [Lvar pv])
when Pvar.is_local pv || Pvar.is_global pv ->
let freed_desc = Errdesc.explain_deallocate_stack_var pv ra in
raise (Exceptions.Deallocate_stack_variable freed_desc)
| Predicates.Apred (Aresource ({ra_kind= Rrelease} as ra), [Const (Cstr s)]) ->
let freed_desc = Errdesc.explain_deallocate_constant_string s ra in
raise (Exceptions.Deallocate_static_memory freed_desc)
| _ ->
()
in
let exp_att_list = Attribute.get_all prop_after in
List.iter ~f:check_deallocated_attribute exp_att_list ;
prop_after
let method_exists right_proc_name methods =
if Language.curr_language_is Java then
List.exists ~f:(fun meth_name -> Procname.equal right_proc_name meth_name) methods
@ -1915,7 +1896,7 @@ and sym_exec_wrapper ({InterproceduralAnalysis.tenv; _} as analysis_data) handle
(* but force them into either branch *)
p'
| _ ->
check_deallocate_static_memory (Abs.abstract_junk analysis_data p')
Abs.abstract_junk analysis_data p'
in
L.d_str "Instruction " ;
Sil.d_instr instr ;

@ -55,21 +55,6 @@ let hpred_is_open_resource tenv prop = function
None
(** Explain a deallocate stack variable error *)
let explain_deallocate_stack_var pvar ra =
let pvar_str = Pvar.to_string pvar in
Localise.desc_deallocate_stack_variable pvar_str ra.PredSymb.ra_pname ra.PredSymb.ra_loc
(** Explain a deallocate constant string error *)
let explain_deallocate_constant_string s ra =
let const_str =
let pp fmt = Exp.pp fmt (Exp.Const (Const.Cstr s)) in
F.asprintf "%t" pp
in
Localise.desc_deallocate_static_memory const_str ra.PredSymb.ra_pname ra.PredSymb.ra_loc
let verbose = Config.trace_error
(** Special case for C++, where we translate code like [struct X; X getX() { X x; return X; }] as

@ -38,12 +38,6 @@ val explain_class_cast_exception :
-> Localise.error_desc
(** explain a class cast exception *)
val explain_deallocate_stack_var : Pvar.t -> PredSymb.res_action -> Localise.error_desc
(** Explain a deallocate stack variable error *)
val explain_deallocate_constant_string : string -> PredSymb.res_action -> Localise.error_desc
(** Explain a deallocate constant string error *)
val explain_dereference :
Procname.t
-> Tenv.t

Loading…
Cancel
Save