From 91d518979bc9c79f8c7047f25f9a6d4f6927af55 Mon Sep 17 00:00:00 2001 From: Sam Blackshear Date: Thu, 3 Aug 2017 17:07:32 -0700 Subject: [PATCH] [quandary] log internal error when taint sink index doesn't match Summary: A temporary workaround until we can understand why this happens and fix it. Reviewed By: jeremydubreil Differential Revision: D5559838 fbshipit-source-id: dc86eb9 --- infer/src/quandary/TaintAnalysis.ml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/infer/src/quandary/TaintAnalysis.ml b/infer/src/quandary/TaintAnalysis.ml index 3787485d1..a8fe9b18e 100644 --- a/infer/src/quandary/TaintAnalysis.ml +++ b/infer/src/quandary/TaintAnalysis.ml @@ -238,8 +238,8 @@ module Make (TaintSpecification : TaintSpec.S) = struct let add_sink sink actuals access_tree proc_data callee_site = (* add [sink] to the trace associated with the [formal_index]th actual *) let add_sink_to_actual sink_index access_tree_acc = - match List.nth_exn actuals sink_index with - | HilExp.AccessPath actual_ap_raw + match List.nth actuals sink_index with + | Some HilExp.AccessPath actual_ap_raw -> ( let actual_ap = AccessPath.Abs.Abstracted actual_ap_raw in match access_path_get_node actual_ap access_tree_acc proc_data with @@ -253,6 +253,11 @@ module Make (TaintSpecification : TaintSpec.S) = struct TaintDomain.add_trace actual_ap actual_trace' access_tree_acc | None -> access_tree_acc ) + | None + -> Logging.internal_error + "Taint is supposed to flow into sink %a at index %d, but the index is out of bounds@\n" + CallSite.pp callee_site sink_index ; + access_tree_acc | _ -> access_tree_acc in