From: Dmitry Antipov Date: Tue, 15 Jul 2014 14:04:06 +0000 (+0400) Subject: * regex.c (re_search_2): Use ssize_t to avoid integer overflow. X-Git-Tag: emacs-25.0.90~2636^2~16 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=6f50c78e70c41c36e56cac89728650d8a049bbeb;p=emacs.git * regex.c (re_search_2): Use ssize_t to avoid integer overflow. --- diff --git a/src/ChangeLog b/src/ChangeLog index a640b970b67..87dd0eacc04 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -6,6 +6,8 @@ Use record_unwind_protect_int and avoid consing. (syms_of_xmenu) [USE_X_TOOLKIT]: Declare WIDGET_ID_TICK_START. + * regex.c (re_search_2): Use ssize_t to avoid integer overflow. + 2014-07-14 Paul Eggert Use binary-io module, O_BINARY, and "b" flag (Bug#18006). diff --git a/src/regex.c b/src/regex.c index ac71b797fbd..1c1164da57d 100644 --- a/src/regex.c +++ b/src/regex.c @@ -4342,8 +4342,7 @@ re_search_2 (struct re_pattern_buffer *bufp, const char *str1, size_t size1, if (range > 0) /* Searching forwards. */ { - register int lim = 0; - ssize_t irange = range; + ssize_t irange = range, lim = 0; if (startpos < size1 && startpos + range >= size1) lim = range - (size1 - startpos);