Ensure VEX control parameters are sane.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3183 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/vg_main.c b/coregrind/vg_main.c
index 808e77c..b0c286a 100644
--- a/coregrind/vg_main.c
+++ b/coregrind/vg_main.c
@@ -1858,7 +1858,17 @@
       }
    }
 
-   // Check various option values
+   /* Make VEX control parameters sane */
+
+   if (VG_(clo_vex_control).guest_chase_thresh
+       >= VG_(clo_vex_control).guest_max_insns)
+      VG_(clo_vex_control).guest_chase_thresh
+         = VG_(clo_vex_control).guest_max_insns - 1;
+
+   if (VG_(clo_vex_control).guest_chase_thresh < 0)
+      VG_(clo_vex_control).guest_chase_thresh = 0;
+
+   /* Check various option values */
 
    if (VG_(clo_verbosity) < 0)
       VG_(clo_verbosity) = 0;