* regex_internal.c (re_string_context_at): Fix bug where the
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 1 Sep 2005 22:10:59 +0000 (22:10 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 1 Sep 2005 22:10:59 +0000 (22:10 +0000)
code assumed that Idx is signed.
* config/srclist.txt: Add glibc bug 1287.

config/ChangeLog
config/srclist.txt
lib/ChangeLog
lib/regex_internal.c

index bcce52d..f68ad17 100644 (file)
@@ -1,6 +1,6 @@
 2005-09-01  Paul Eggert  <eggert@cs.ucla.edu>
 
-       * srclist.txt: Add glibc bug 1285, 1286.
+       * srclist.txt: Add glibc bugs 1285-1287.
 
 2005-08-31  Paul Eggert  <eggert@cs.ucla.edu>
 
index 8f2432b..ca3b7ec 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: srclist.txt,v 1.97 2005-09-01 21:01:27 eggert Exp $
+# $Id: srclist.txt,v 1.98 2005-09-01 22:10:59 eggert Exp $
 # Files for which we are not the source.  See ./srclistvars.sh for the
 # variable definitions.
 
@@ -136,6 +136,7 @@ $LIBCSRC/stdlib/getsubopt.c         lib gpl
 # http://sources.redhat.com/bugzilla/show_bug.cgi?id=1284
 # http://sources.redhat.com/bugzilla/show_bug.cgi?id=1285
 # http://sources.redhat.com/bugzilla/show_bug.cgi?id=1286
+# http://sources.redhat.com/bugzilla/show_bug.cgi?id=1287
 #$LIBCSRC/posix/regex_internal.c               lib gpl
 #
 # http://sources.redhat.com/bugzilla/show_bug.cgi?id=1054
index 973388a..ecb3b60 100644 (file)
@@ -2,6 +2,8 @@
 
        * regex_internal.c (build_wcs_upper_buffer): Fix portability
        bugs in int versus size_t comparisons.
+       (re_string_context_at): Fix bug where the code assumed that
+       Idx is signed.
 
        Use bool where appropriate.
        * regcomp.c (re_set_fastmap): ICASE arg is bool, not int.
index 24c61ec..57ba44d 100644 (file)
@@ -843,10 +843,10 @@ re_string_context_at (const re_string_t *input, Idx idx, int eflags)
        {
 #ifdef DEBUG
          /* It must not happen.  */
-         assert (wc_idx >= 0);
+         assert (REG_VALID_INDEX (wc_idx));
 #endif
          --wc_idx;
-         if (wc_idx < 0)
+         if (! REG_VALID_INDEX (wc_idx))
            return input->tip_context;
        }
       wc = input->wcs[wc_idx];