summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-01-18 09:34:50 +0000
committerUlrich Drepper <drepper@redhat.com>2000-01-18 09:34:50 +0000
commit9281f45d10af14f1f1dd884e8c77d293240c7412 (patch)
treee104b4c82d22e0932f3ec1dbb1a98611ebb24bc6
parentf1a785acbf05051be4963474f2307aad77fff16b (diff)
downloadglibc-9281f45d10af14f1f1dd884e8c77d293240c7412.tar.gz
glibc-9281f45d10af14f1f1dd884e8c77d293240c7412.tar.xz
glibc-9281f45d10af14f1f1dd884e8c77d293240c7412.zip
Update.
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).
-rw-r--r--ChangeLog10
-rw-r--r--posix/bits/posix2_lim.h7
-rw-r--r--posix/regex.c15
-rw-r--r--posix/regex.h10
-rw-r--r--sysdeps/posix/sysconf.c4
5 files changed, 31 insertions, 15 deletions
diff --git a/ChangeLog b/ChangeLog
index fdd00cca2a..873f95d7d7 100644
--- 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
diff --git a/posix/bits/posix2_lim.h b/posix/bits/posix2_lim.h
index a9d067e4de..927c017a2a 100644
--- a/posix/bits/posix2_lim.h
+++ b/posix/bits/posix2_lim.h
@@ -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
@@ -85,12 +85,11 @@
 #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 */
diff --git a/posix/regex.c b/posix/regex.c
index d036a7dd3a..6dd3d2a96f 100644
--- a/posix/regex.c
+++ b/posix/regex.c
@@ -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);
diff --git a/posix/regex.h b/posix/regex.h
index d88ab92bd4..f8a123054b 100644
--- a/posix/regex.h
+++ b/posix/regex.h
@@ -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.  */
diff --git a/sysdeps/posix/sysconf.c b/sysdeps/posix/sysconf.c
index e30723f177..e3177d0155 100644
--- a/sysdeps/posix/sysconf.c
+++ b/sysdeps/posix/sysconf.c
@@ -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.  */