From 6aee686cb2f07ce54310bbb9fc02dc0174bb91db Mon Sep 17 00:00:00 2001 From: Sam Blackshear Date: Thu, 13 Oct 2016 16:06:59 -0700 Subject: [PATCH] [quandary] passing actuals to the sink-determining code Differential Revision: D4012216 fbshipit-source-id: 86e8aca --- infer/src/quandary/CppTrace.ml | 2 +- infer/src/quandary/JavaTrace.ml | 2 +- infer/src/quandary/Sink.ml | 3 ++- infer/src/quandary/TaintAnalysis.ml | 2 +- infer/src/unit/TaintTests.ml | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/infer/src/quandary/CppTrace.ml b/infer/src/quandary/CppTrace.ml index a5c741040..530fa578b 100644 --- a/infer/src/quandary/CppTrace.ml +++ b/infer/src/quandary/CppTrace.ml @@ -121,7 +121,7 @@ module CppSink = struct let make kind site = { kind; site; } - let get site = + let get site _ = match CallSite.pname site with | (Procname.ObjC_Cpp cpp_pname) as pname -> begin diff --git a/infer/src/quandary/JavaTrace.ml b/infer/src/quandary/JavaTrace.ml index 8d347c569..631f81941 100644 --- a/infer/src/quandary/JavaTrace.ml +++ b/infer/src/quandary/JavaTrace.ml @@ -136,7 +136,7 @@ module JavaSink = struct let make kind site = { kind; site; } - let get site = + let get site _ = (* taint all the inputs of [pname]. for non-static procedures, taints the "this" parameter only if [taint_this] is true. *) let taint_all ?(taint_this=false) pname kind site ~report_reachable = diff --git a/infer/src/quandary/Sink.ml b/infer/src/quandary/Sink.ml index c8354bf66..3be9b8a2f 100644 --- a/infer/src/quandary/Sink.ml +++ b/infer/src/quandary/Sink.ml @@ -25,5 +25,6 @@ module type S = sig val to_callee : t -> CallSite.t -> t - val get : CallSite.t -> t parameter list + (** return the parameter index and sink kind for the given call site with the given actuals *) + val get : CallSite.t -> (Exp.t * Typ.t) list -> t parameter list end diff --git a/infer/src/quandary/TaintAnalysis.ml b/infer/src/quandary/TaintAnalysis.ml index b3f801244..ccb8438b7 100644 --- a/infer/src/quandary/TaintAnalysis.ml +++ b/infer/src/quandary/TaintAnalysis.ml @@ -301,7 +301,7 @@ module Make (TaintSpec : TaintSpec.S) = struct let call_site = CallSite.make callee_pname callee_loc in let astate_with_sink = - match TraceDomain.Sink.get call_site with + match TraceDomain.Sink.get call_site actuals with | [] -> astate | sinks -> add_sinks sinks actuals astate proc_data callee_loc in diff --git a/infer/src/unit/TaintTests.ml b/infer/src/unit/TaintTests.ml index b32c8b5a9..cbea2c647 100644 --- a/infer/src/unit/TaintTests.ml +++ b/infer/src/unit/TaintTests.ml @@ -49,7 +49,7 @@ module MockTrace = Trace.Make(struct module Sink = struct include MockTraceElem - let get site = + let get site _ = if string_is_prefix "SINK" (Procname.to_string (CallSite.pname site)) then [Sink.make_sink_param site 0 ~report_reachable:false] else []