changeset 20924:eda7e44ef9d9

(search_command): Check LIM in valid range before calling CHAR_TO_BYTE.
author Karl Heuer <kwzh@gnu.org>
date Wed, 18 Feb 1998 22:54:43 +0000
parents c6e733c90ed8
children f61425242f70
files src/search.c
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/search.c	Wed Feb 18 09:12:24 1998 +0000
+++ b/src/search.c	Wed Feb 18 22:54:43 1998 +0000
@@ -880,13 +880,14 @@
     {
       CHECK_NUMBER_COERCE_MARKER (bound, 1);
       lim = XINT (bound);
-      lim_byte = CHAR_TO_BYTE (lim);
       if (n > 0 ? lim < PT : lim > PT)
 	error ("Invalid search bound (wrong side of point)");
       if (lim > ZV)
 	lim = ZV, lim_byte = ZV_BYTE;
-      if (lim < BEGV)
+      else if (lim < BEGV)
 	lim = BEGV, lim_byte = BEGV_BYTE;
+      else
+	lim_byte = CHAR_TO_BYTE (lim);
     }
 
   np = search_buffer (string, PT, PT_BYTE, lim, lim_byte, n, RE,