+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
-/* 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 */
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
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);
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. */
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);
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);
/* 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.
(_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. */
-/* 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
#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. */