Update.
authorUlrich Drepper <drepper@redhat.com>
Tue, 18 Jan 2000 09:34:50 +0000 (09:34 +0000)
committerUlrich Drepper <drepper@redhat.com>
Tue, 18 Jan 2000 09:34:50 +0000 (09:34 +0000)
2000-01-18  Ulrich Drepper  <drepper@cygnus.com>

* posix/regex.h (RE_SYNTAX_POSIX_EXTENDED): Add RE_CONTEXT_INVALID_OPS.
* posix/regex.c (regex_compile): Return appropriate errors for
unterminated brace expressions.  Detect invalid characters
in brace expressions.
* posix/bits/posix2_lim.h: Define RE_DUP_MAX correctly.
* sysdeps/posix/sysconf.c: Include regex.h.
Reported by Geoff Clare <gwc@unisoft.com> (PR libc/1522).

ChangeLog
posix/bits/posix2_lim.h
posix/regex.c
posix/regex.h
sysdeps/posix/sysconf.c

index fdd00cc..873f95d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2000-01-18  Ulrich Drepper  <drepper@cygnus.com>
+
+       * posix/regex.h (RE_SYNTAX_POSIX_EXTENDED): Add RE_CONTEXT_INVALID_OPS.
+       * posix/regex.c (regex_compile): Return appropriate errors for
+       unterminated brace expressions.  Detect invalid characters
+       in brace expressions.
+       * posix/bits/posix2_lim.h: Define RE_DUP_MAX correctly.
+       * sysdeps/posix/sysconf.c: Include regex.h.
+       Reported by Geoff Clare <gwc@unisoft.com> (PR libc/1522).
+
 2000-01-17  Ulrich Drepper  <drepper@cygnus.com>
 
        * sysdeps/posix/getaddrinfo.c (gaih_local): If name is given and
index a9d067e..927c017 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1996, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1996, 1999, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
 #ifndef        LINE_MAX
 #define        LINE_MAX                _POSIX2_LINE_MAX
 #endif
-#ifndef        RE_DUP_MAX
-#define        RE_DUP_MAX              _POSIX2_RE_DUP_MAX
-#endif
 #ifndef        CHARCLASS_NAME_MAX
 #define        CHARCLASS_NAME_MAX      _POSIX2_CHARCLASS_NAME_MAX
 #endif
 
+/* This value is defined like this in regex.h.  */
+#define        RE_DUP_MAX (0x7fff)
 
 #endif /* bits/posix2_lim.h */
index d036a7d..6dd3d2a 100644 (file)
@@ -2,7 +2,7 @@
    version 0.12.
    (Implements POSIX draft P1003.2/D11.2, except for some of the
    internationalization features.)
-   Copyright (C) 1993, 94, 95, 96, 97, 98, 99 Free Software Foundation, Inc.
+   Copyright (C) 1993-1999, 2000 Free Software Foundation, Inc.
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public License as
@@ -2910,7 +2910,7 @@ regex_compile (pattern, size, syntax, bufp)
 
                 if (p == pend)
                   {
-                    if (syntax & RE_NO_BK_BRACES)
+                    if (!(syntax & RE_INTERVALS) && (syntax & RE_NO_BK_BRACES))
                       goto unfetch_interval;
                     else
                       FREE_STACK_RETURN (REG_EBRACE);
@@ -2921,7 +2921,12 @@ regex_compile (pattern, size, syntax, bufp)
                 if (c == ',')
                   {
                     GET_UNSIGNED_NUMBER (upper_bound);
-                    if (upper_bound < 0) upper_bound = RE_DUP_MAX;
+                   if ((!(syntax & RE_NO_BK_BRACES) && c != '\\')
+                       || ((syntax & RE_NO_BK_BRACES) && c != '}'))
+                     FREE_STACK_RETURN (REG_BADBR);
+
+                   if (upper_bound < 0)
+                     upper_bound = RE_DUP_MAX;
                   }
                 else
                   /* Interval such as `{1}' => match exactly once. */
@@ -2930,7 +2935,7 @@ regex_compile (pattern, size, syntax, bufp)
                 if (lower_bound < 0 || upper_bound > RE_DUP_MAX
                     || lower_bound > upper_bound)
                   {
-                    if (syntax & RE_NO_BK_BRACES)
+                    if (!(syntax & RE_INTERVALS) && (syntax & RE_NO_BK_BRACES))
                       goto unfetch_interval;
                     else
                       FREE_STACK_RETURN (REG_BADBR);
@@ -2945,7 +2950,7 @@ regex_compile (pattern, size, syntax, bufp)
 
                 if (c != '}')
                   {
-                    if (syntax & RE_NO_BK_BRACES)
+                    if (!(syntax & RE_INTERVALS) && (syntax & RE_NO_BK_BRACES))
                       goto unfetch_interval;
                     else
                       FREE_STACK_RETURN (REG_BADBR);
index d88ab92..f8a1230 100644 (file)
@@ -1,6 +1,6 @@
 /* Definitions for data structures and routines for the regular
    expression library, version 0.12.
-   Copyright (C) 1985,89,90,91,92,93,95,96,97,98 Free Software Foundation, Inc.
+   Copyright (C) 1985,1989-1993,1995-1998, 2000 Free Software Foundation, Inc.
 
    This file is part of the GNU C Library.  Its master source is NOT part of
    the C library, however.  The master source lives in /gd/gnu/lib.
@@ -221,10 +221,10 @@ extern reg_syntax_t re_syntax_options;
   (_RE_SYNTAX_POSIX_COMMON | RE_LIMITED_OPS)
 
 #define RE_SYNTAX_POSIX_EXTENDED                                       \
-  (_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS                  \
-   | RE_CONTEXT_INDEP_OPS  | RE_NO_BK_BRACES                           \
-   | RE_NO_BK_PARENS       | RE_NO_BK_VBAR                             \
-   | RE_UNMATCHED_RIGHT_PAREN_ORD)
+  (_RE_SYNTAX_POSIX_COMMON  | RE_CONTEXT_INDEP_ANCHORS                 \
+   | RE_CONTEXT_INDEP_OPS   | RE_NO_BK_BRACES                          \
+   | RE_NO_BK_PARENS        | RE_NO_BK_VBAR                            \
+   | RE_CONTEXT_INVALID_OPS | RE_UNMATCHED_RIGHT_PAREN_ORD)
 
 /* Differs from ..._POSIX_EXTENDED in that RE_CONTEXT_INVALID_OPS
    replaces RE_CONTEXT_INDEP_OPS and RE_NO_BK_REFS is added.  */
index e30723f..e3177d0 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 93, 95, 96, 97, 99 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 93, 95, 96, 97, 99, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -25,6 +25,8 @@
 #include <time.h>
 #include <unistd.h>
 #include <sys/sysinfo.h>
+#include <sys/types.h>
+#include <regex.h>
 
 
 /* Get the value of the system variable NAME.  */