From a187d1b0b644e42bd9ace3801f612919b3876c6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ezgi=20=C3=87i=C3=A7ek?= Date: Mon, 13 Jan 2020 04:04:22 -0800 Subject: [PATCH] [pulse] Fix unequal length Reviewed By: jvillard Differential Revision: D19371310 fbshipit-source-id: 8de1338be --- infer/src/pulse/PulseOperations.ml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/infer/src/pulse/PulseOperations.ml b/infer/src/pulse/PulseOperations.ml index d4443ba9c..31d30a4bd 100644 --- a/infer/src/pulse/PulseOperations.ml +++ b/infer/src/pulse/PulseOperations.ml @@ -505,11 +505,19 @@ let unknown_call call_loc reason ~ret ~actuals ~formals_opt astate = List.fold actuals ~f:(fun astate actual_typ -> havoc_actual_if_ptr actual_typ None astate) ~init:astate - | Some formals -> - List.fold2_exn actuals formals + | Some formals -> ( + match + List.fold2 actuals formals ~f:(fun astate actual_typ (_, formal_typ) -> havoc_actual_if_ptr actual_typ (Some formal_typ) astate ) - ~init:astate ) + ~init:astate + with + | Unequal_lengths -> + L.d_printfln "ERROR: formals have length %d but actuals have length %d" + (List.length formals) (List.length actuals) ; + astate + | Ok result -> + result ) ) |> havoc_ret ret