From: Richard M. Stallman Date: Wed, 18 Jun 1997 16:46:05 +0000 (+0000) Subject: (Fchar_before): Validate N after decrementing. X-Git-Tag: emacs-20.1~1631 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=089e3cb0acf24f8c182f81192ab52b6c6211f05d;p=emacs.git (Fchar_before): Validate N after decrementing. Don't use POS as integer. --- diff --git a/src/editfns.c b/src/editfns.c index ccd2e6fb367..c4cc3019708 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -608,19 +608,21 @@ is returned as a character.") 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; }