# HG changeset patch # User Rob Hoes CA-40329: Fix the bound checks in the Ipq.find* functions. Signed-off-by: Rob Hoes diff -r 256e76148ba4 ocaml/xapi/ipq.ml --- a/ocaml/xapi/ipq.ml Mon Apr 12 20:32:36 2010 +0100 +++ b/ocaml/xapi/ipq.ml Wed Apr 14 14:34:43 2010 +0100 @@ -87,17 +87,15 @@ let find h ev = let rec iter n = - match n with - -1 -> -1 - | m -> if ev = h.data.(n).ev then n else iter (n-1) + if n < 0 then -1 + else if ev = h.data.(n).ev then n else iter (n-1) in iter (h.size-1) let find_p h f = let rec iter n = - match n with - -1 -> -1 - | m -> if f h.data.(n).ev then n else iter (n-1) + if n < 0 then -1 + else if f h.data.(n).ev then n else iter (n-1) in iter (h.size-1)