* 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 bcce52d4d17f35e8751ac9e2ed8bf466f80779a9..f68ad17581e570e77d70f1db1bbb9199a81658f7 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 8f2432bf2c9eb3153cbcc68f160a935b6e96cd9e..ca3b7ec4f5acb1a579d2c69158cd344eddf22fa3 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 973388a78a15fa10b6ed10c6a12069d4a0671847..ecb3b603ea2814411b60450ce0a853461cfcf16b 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 24c61ecf7a18fdd4de9a168f72c49f26ac860157..57ba44d10656b4b1292fa6ef91ac46a38241109a 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];