changeset 18315:3090657a944b

(Fchar_before): Validate N after decrementing. Don't use POS as integer.
author Richard M. Stallman <rms@gnu.org>
date Wed, 18 Jun 1997 16:46:05 +0000
parents 6e13dd3d1e11
children 1058f8684eca
files src/editfns.c
diffstat 1 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/editfns.c	Wed Jun 18 16:37:01 1997 +0000
+++ b/src/editfns.c	Wed Jun 18 16:46:05 1997 +0000
@@ -608,19 +608,21 @@
       CHECK_NUMBER_COERCE_MARKER (pos, 0);
 
       n = XINT (pos);
-      if (n < BEGV || n >= ZV)
-	return Qnil;
     }
 
   if (!NILP (current_buffer->enable_multibyte_characters))
     {
-      DEC_POS (pos);
-      XSETFASTINT (val, FETCH_CHAR (pos));
+      DEC_POS (n);
+      if (n < BEGV || n >= ZV)
+	return Qnil;
+      XSETFASTINT (val, FETCH_CHAR (n));
     }
   else
     {
-      pos--;
-      XSETFASTINT (val, FETCH_BYTE (pos));
+      n--;
+      if (n < BEGV || n >= ZV)
+	return Qnil;
+      XSETFASTINT (val, FETCH_BYTE (n));
     }
    return val;
 }