diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-03-05 10:08:13 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-03-05 10:08:13 +0900 |
commit | 61fb427c104d6f2334aaee9c7d90d8287d521b17 (patch) | |
tree | e4caa30fa69cb51705f22392cab8cf9c04dffb94 /lib/regcomp.c | |
parent | 1478f6ab011981e9a986c0c30da680635d3e77bf (diff) | |
download | wget-61fb427c104d6f2334aaee9c7d90d8287d521b17.tar.gz wget-61fb427c104d6f2334aaee9c7d90d8287d521b17.tar.bz2 wget-61fb427c104d6f2334aaee9c7d90d8287d521b17.zip |
Imported Upstream version 1.16.1upstream/1.16.1
Diffstat (limited to 'lib/regcomp.c')
-rw-r--r-- | lib/regcomp.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/lib/regcomp.c b/lib/regcomp.c index f0b2e52..4763ea7 100644 --- a/lib/regcomp.c +++ b/lib/regcomp.c @@ -1,5 +1,5 @@ /* Extended regular expression matching and search library. - Copyright (C) 2002-2013 Free Software Foundation, Inc. + Copyright (C) 2002-2014 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>. @@ -2199,7 +2199,11 @@ parse_reg_exp (re_string_t *regexp, regex_t *preg, re_token_t *token, { branch = parse_branch (regexp, preg, token, syntax, nest, err); if (BE (*err != REG_NOERROR && branch == NULL, 0)) - return NULL; + { + if (tree != NULL) + postorder (tree, free_tree, NULL); + return NULL; + } } else branch = NULL; @@ -2460,14 +2464,22 @@ parse_expression (re_string_t *regexp, regex_t *preg, re_token_t *token, while (token->type == OP_DUP_ASTERISK || token->type == OP_DUP_PLUS || token->type == OP_DUP_QUESTION || token->type == OP_OPEN_DUP_NUM) { - tree = parse_dup_op (tree, regexp, dfa, token, syntax, err); - if (BE (*err != REG_NOERROR && tree == NULL, 0)) - return NULL; + bin_tree_t *dup_tree = parse_dup_op (tree, regexp, dfa, token, + syntax, err); + if (BE (*err != REG_NOERROR && dup_tree == NULL, 0)) + { + if (tree != NULL) + postorder (tree, free_tree, NULL); + return NULL; + } + tree = dup_tree; /* In BRE consecutive duplications are not allowed. */ if ((syntax & RE_CONTEXT_INVALID_DUP) && (token->type == OP_DUP_ASTERISK || token->type == OP_OPEN_DUP_NUM)) { + if (tree != NULL) + postorder (tree, free_tree, NULL); *err = REG_BADRPT; return NULL; } @@ -2623,6 +2635,8 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa, /* Duplicate ELEM before it is marked optional. */ elem = duplicate_tree (elem, dfa); + if (BE (elem == NULL, 0)) + goto parse_dup_op_espace; old_tree = tree; } else |