mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-12 16:20:06 +00:00
Update.
* posix/regcomp.c (parse_expression): If token is OP_OPEN_DUP_NUM and RE_CONTEXT_INVALID_DUP syntax flag is set, fail. * posix/regex.h (RE_CONTEXT_INVALUD_OPS): New macro. (RE_SYNTAX_POSIX_BASIC): Use RE_CONTEXT_INVALUD_OPS. * posix/regcomp.c (parse_sub_exp): In case of not-matching ( ) return REG_EPAREN.
This commit is contained in:
parent
813ec65a4d
commit
06e8303a28
@ -1,5 +1,13 @@
|
|||||||
2003-11-12 Ulrich Drepper <drepper@redhat.com>
|
2003-11-12 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
* posix/regcomp.c (parse_expression): If token is OP_OPEN_DUP_NUM
|
||||||
|
and RE_CONTEXT_INVALID_DUP syntax flag is set, fail.
|
||||||
|
* posix/regex.h (RE_CONTEXT_INVALUD_OPS): New macro.
|
||||||
|
(RE_SYNTAX_POSIX_BASIC): Use RE_CONTEXT_INVALUD_OPS.
|
||||||
|
|
||||||
|
* posix/regcomp.c (parse_sub_exp): In case of not-matching ( )
|
||||||
|
return REG_EPAREN.
|
||||||
|
|
||||||
* posix/PTESTS: Cleanup. Fix typoes. Correct bugs in 2003.2.
|
* posix/PTESTS: Cleanup. Fix typoes. Correct bugs in 2003.2.
|
||||||
* posix/runptests.c (main): Handle comments.
|
* posix/runptests.c (main): Handle comments.
|
||||||
* posix/PTESTS2C.sed: Handle comments.
|
* posix/PTESTS2C.sed: Handle comments.
|
||||||
|
@ -122,7 +122,7 @@ static reg_errcode_t build_charclass (RE_TRANSLATE_TYPE trans,
|
|||||||
reg_syntax_t syntax);
|
reg_syntax_t syntax);
|
||||||
#endif /* not RE_ENABLE_I18N */
|
#endif /* not RE_ENABLE_I18N */
|
||||||
static bin_tree_t *build_charclass_op (re_dfa_t *dfa, RE_TRANSLATE_TYPE trans,
|
static bin_tree_t *build_charclass_op (re_dfa_t *dfa, RE_TRANSLATE_TYPE trans,
|
||||||
const unsigned char *class_name,
|
const unsigned char *class_name,
|
||||||
const unsigned char *extra, int not,
|
const unsigned char *extra, int not,
|
||||||
reg_errcode_t *err);
|
reg_errcode_t *err);
|
||||||
static void free_bin_tree (bin_tree_t *tree);
|
static void free_bin_tree (bin_tree_t *tree);
|
||||||
@ -2095,10 +2095,16 @@ parse_expression (regexp, preg, token, syntax, nest, err)
|
|||||||
++dfa->nbackref;
|
++dfa->nbackref;
|
||||||
dfa->has_mb_node = 1;
|
dfa->has_mb_node = 1;
|
||||||
break;
|
break;
|
||||||
|
case OP_OPEN_DUP_NUM:
|
||||||
|
if (syntax & RE_CONTEXT_INVALID_DUP)
|
||||||
|
{
|
||||||
|
*err = REG_BADRPT;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
/* FALLTHROUGH */
|
||||||
case OP_DUP_ASTERISK:
|
case OP_DUP_ASTERISK:
|
||||||
case OP_DUP_PLUS:
|
case OP_DUP_PLUS:
|
||||||
case OP_DUP_QUESTION:
|
case OP_DUP_QUESTION:
|
||||||
case OP_OPEN_DUP_NUM:
|
|
||||||
if (syntax & RE_CONTEXT_INVALID_OPS)
|
if (syntax & RE_CONTEXT_INVALID_OPS)
|
||||||
{
|
{
|
||||||
*err = REG_BADRPT;
|
*err = REG_BADRPT;
|
||||||
@ -2292,7 +2298,7 @@ parse_sub_exp (regexp, preg, token, syntax, nest, err)
|
|||||||
if (BE (token->type != OP_CLOSE_SUBEXP, 0))
|
if (BE (token->type != OP_CLOSE_SUBEXP, 0))
|
||||||
{
|
{
|
||||||
free_bin_tree (tree);
|
free_bin_tree (tree);
|
||||||
*err = REG_BADPAT;
|
*err = REG_EPAREN;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
new_idx = re_dfa_add_node (dfa, *token, 0);
|
new_idx = re_dfa_add_node (dfa, *token, 0);
|
||||||
|
@ -175,6 +175,10 @@ typedef unsigned long int reg_syntax_t;
|
|||||||
whether ^ should be special. */
|
whether ^ should be special. */
|
||||||
#define RE_CARET_ANCHORS_HERE (RE_ICASE << 1)
|
#define RE_CARET_ANCHORS_HERE (RE_ICASE << 1)
|
||||||
|
|
||||||
|
/* If this bit is set, then \{ cannot be first in an bre or
|
||||||
|
immediately after an alternation or begin-group operator. */
|
||||||
|
#define RE_CONTEXT_INVALID_DUP (RE_CARET_ANCHORS_HERE << 1)
|
||||||
|
|
||||||
/* This global variable defines the particular regexp syntax to use (for
|
/* This global variable defines the particular regexp syntax to use (for
|
||||||
some interfaces). When a regexp is compiled, the syntax used is
|
some interfaces). When a regexp is compiled, the syntax used is
|
||||||
stored in the pattern buffer, so changing this does not affect
|
stored in the pattern buffer, so changing this does not affect
|
||||||
@ -229,7 +233,7 @@ extern reg_syntax_t re_syntax_options;
|
|||||||
| RE_INTERVALS | RE_NO_EMPTY_RANGES)
|
| RE_INTERVALS | RE_NO_EMPTY_RANGES)
|
||||||
|
|
||||||
#define RE_SYNTAX_POSIX_BASIC \
|
#define RE_SYNTAX_POSIX_BASIC \
|
||||||
(_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM)
|
(_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM | RE_CONTEXT_INVALID_DUP)
|
||||||
|
|
||||||
/* Differs from ..._POSIX_BASIC only in that RE_BK_PLUS_QM becomes
|
/* Differs from ..._POSIX_BASIC only in that RE_BK_PLUS_QM becomes
|
||||||
RE_LIMITED_OPS, i.e., \? \+ \| are not recognized. Actually, this
|
RE_LIMITED_OPS, i.e., \? \+ \| are not recognized. Actually, this
|
||||||
|
Loading…
Reference in New Issue
Block a user