summaryrefslogtreecommitdiff
path: root/posix/regcomp.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-11-13 06:01:46 +0000
committerUlrich Drepper <drepper@redhat.com>2003-11-13 06:01:46 +0000
commit06e8303a288f626929d69e57eb4128b2e40b1313 (patch)
tree992c00ec8ac45cd0d97a5778bb1b947799588469 /posix/regcomp.c
parent813ec65a4d69dcf9b2ecaf42395a4ba62dd2d33c (diff)
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.
Diffstat (limited to 'posix/regcomp.c')
-rw-r--r--posix/regcomp.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/posix/regcomp.c b/posix/regcomp.c
index ce91ef6807..c404929811 100644
--- a/posix/regcomp.c
+++ b/posix/regcomp.c
@@ -122,7 +122,7 @@ static reg_errcode_t build_charclass (RE_TRANSLATE_TYPE trans,
reg_syntax_t syntax);
#endif /* not RE_ENABLE_I18N */
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,
reg_errcode_t *err);
static void free_bin_tree (bin_tree_t *tree);
@@ -2095,10 +2095,16 @@ parse_expression (regexp, preg, token, syntax, nest, err)
++dfa->nbackref;
dfa->has_mb_node = 1;
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_PLUS:
case OP_DUP_QUESTION:
- case OP_OPEN_DUP_NUM:
if (syntax & RE_CONTEXT_INVALID_OPS)
{
*err = REG_BADRPT;
@@ -2292,7 +2298,7 @@ parse_sub_exp (regexp, preg, token, syntax, nest, err)
if (BE (token->type != OP_CLOSE_SUBEXP, 0))
{
free_bin_tree (tree);
- *err = REG_BADPAT;
+ *err = REG_EPAREN;
return NULL;
}
new_idx = re_dfa_add_node (dfa, *token, 0);