From 9581d12ccba50fb818aa2ad5857a54a51a305993 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 1 Sep 2005 22:10:59 +0000 Subject: [PATCH] * regex_internal.c (re_string_context_at): Fix bug where the code assumed that Idx is signed. * config/srclist.txt: Add glibc bug 1287. --- config/ChangeLog | 2 +- config/srclist.txt | 3 ++- lib/ChangeLog | 2 ++ lib/regex_internal.c | 4 ++-- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/config/ChangeLog b/config/ChangeLog index bcce52d4d..f68ad1758 100644 --- a/config/ChangeLog +++ b/config/ChangeLog @@ -1,6 +1,6 @@ 2005-09-01 Paul Eggert - * srclist.txt: Add glibc bug 1285, 1286. + * srclist.txt: Add glibc bugs 1285-1287. 2005-08-31 Paul Eggert diff --git a/config/srclist.txt b/config/srclist.txt index 8f2432bf2..ca3b7ec4f 100644 --- a/config/srclist.txt +++ b/config/srclist.txt @@ -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 diff --git a/lib/ChangeLog b/lib/ChangeLog index 973388a78..ecb3b603e 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -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. diff --git a/lib/regex_internal.c b/lib/regex_internal.c index 24c61ecf7..57ba44d10 100644 --- a/lib/regex_internal.c +++ b/lib/regex_internal.c @@ -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]; -- 2.11.0