logging errors

Reviewed By: dkgi

Differential Revision: D3806718

fbshipit-source-id: 3abe08a
master
Sam Blackshear 8 years ago committed by Facebook Github Bot 0
parent 50ac3cde41
commit 91071af3ad

@ -60,6 +60,7 @@ ISSUE_TYPES = [
'REGISTERED_OBSERVER_BEING_DEALLOCATED',
'ASSIGN_POINTER_WARNING',
'GLOBAL_VARIABLE_INITIALIZED_WITH_FUNCTION_OR_METHOD_CALL',
'QUANDARY_TAINT_ERROR',
# TODO (t11307776): Turn this back on once some of the FP issues are fixed
'UNSAFE_GUARDED_BY_ACCESS',
]

@ -134,6 +134,10 @@ module Make (TraceDomain : Trace.S) = struct
| Some (actual_trace, _) ->
(* add callee_pname to actual trace as a sink *)
let actual_trace' = TraceDomain.add_sink sink actual_trace in
TraceDomain.log_reports
actual_trace'
(Cfg.Procdesc.get_proc_name proc_data.ProcData.pdesc)
loc;
TaintDomain.add_trace actual_ap actual_trace' access_tree_acc
| None ->
access_tree_acc

@ -35,6 +35,9 @@ module type S = sig
(** get the reportable source-sink flows in this trace *)
val get_reports : t -> (Source.t * Sink.t * Passthrough.Set.t) list
(** log the reportable source-sink flows in this trace *)
val log_reports : t -> Procname.t -> Location.t -> unit
(** create a trace from a source *)
val of_source : Source.t -> t
@ -99,6 +102,19 @@ module Make (Spec : Spec) = struct
else acc in
Sources.fold (fun source acc -> Sinks.fold (report_one source) t.sinks acc) t.sources []
let log_reports t pname loc =
let report_one (source, sink, passthroughs) =
let pp_error fmt () =
F.fprintf
fmt
"Error: %a -> %a via %a"
Source.pp source Sink.pp sink Passthrough.Set.pp passthroughs in
let msg = "QUANDARY_TAINT_ERROR" in
let description = pp_to_string pp_error () in
let exn = Exceptions.Checkers (msg, Localise.verbatim_desc description) in
Reporting.log_error pname exn ~loc in
IList.iter report_one (get_reports t)
let of_source source =
let sources = Sources.singleton source in
let passthroughs = Passthrough.Set.empty in

Loading…
Cancel
Save