diff --git a/infer/src/bufferoverrun/bufferOverrunChecker.ml b/infer/src/bufferoverrun/bufferOverrunChecker.ml index 69df868f6..661764e8b 100644 --- a/infer/src/bufferoverrun/bufferOverrunChecker.ml +++ b/infer/src/bufferoverrun/bufferOverrunChecker.ml @@ -586,7 +586,7 @@ module Report = struct let error_desc = Localise.desc_buffer_overrun description in let exn = Exceptions.Checkers (issue_type, error_desc) in let trace = - match TraceSet.choose_shortest trace.PO.ConditionTrace.val_traces with + match TraceSet.choose_shortest (PO.ConditionTrace.get_val_traces trace) with | trace -> make_err_trace trace description | exception _ -> diff --git a/infer/src/bufferoverrun/bufferOverrunProofObligations.ml b/infer/src/bufferoverrun/bufferOverrunProofObligations.ml index a671ba107..74e0a03b0 100644 --- a/infer/src/bufferoverrun/bufferOverrunProofObligations.ml +++ b/infer/src/bufferoverrun/bufferOverrunProofObligations.ml @@ -390,6 +390,8 @@ module ConditionTrace = struct () + let get_val_traces {val_traces} = val_traces + let get_report_location : t -> Location.t = fun ct -> match ct.cond_trace with Intra -> ct.issue_location | Inter {call_site} -> call_site diff --git a/infer/src/bufferoverrun/bufferOverrunProofObligations.mli b/infer/src/bufferoverrun/bufferOverrunProofObligations.mli new file mode 100644 index 000000000..7fa356517 --- /dev/null +++ b/infer/src/bufferoverrun/bufferOverrunProofObligations.mli @@ -0,0 +1,54 @@ +(* + * Copyright (c) 2018-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + *) + +open! IStd +open! AbstractDomain.Types +module ItvPure = Itv.ItvPure +module Relation = BufferOverrunDomainRelation +module ValTraceSet = BufferOverrunTrace.Set + +module Condition : sig + type t +end + +module ConditionTrace : sig + type t + + val get_report_location : t -> Location.t + + val get_val_traces : t -> ValTraceSet.t +end + +module ConditionSet : sig + type t + + val empty : t + + val pp : Format.formatter -> t -> unit + + val pp_summary : Format.formatter -> t -> unit + + val add_array_access : + Location.t -> idx:ItvPure.astate -> size:ItvPure.astate -> is_collection_add:bool + -> idx_sym_exp:Relation.SymExp.t option -> size_sym_exp:Relation.SymExp.t option + -> relation:Relation.astate -> ValTraceSet.t -> t -> t + + val add_alloc_size : Location.t -> length:ItvPure.astate -> ValTraceSet.t -> t -> t + + val join : t -> t -> t + + val subst : + t -> Bounds.Bound.t bottom_lifted Symb.SymbolMap.t * ValTraceSet.t Symb.SymbolMap.t + -> Relation.SubstMap.t -> Relation.astate -> Typ.Procname.t -> Location.t -> t + + val check_all : report:(Condition.t -> ConditionTrace.t -> IssueType.t -> unit) -> t -> t + (** Check the conditions, call [report] on those that trigger an issue, returns those that needs to be propagated to callers. *) + + val forget_locs : AbsLoc.PowLoc.t -> t -> t +end + +val description : Condition.t -> ConditionTrace.t -> string