diff options
author | Ulrich Drepper <drepper@redhat.com> | 2005-02-22 05:07:20 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2005-02-22 05:07:20 +0000 |
commit | 744eb12b7b0aa4ea0543e8dfd21b49bb5309bf93 (patch) | |
tree | 1070955160a5ef90fe2144ded572b6147e91501f /posix/regcomp.c | |
parent | e13e33e279e193191e06811cb7ae3518d7acad1a (diff) | |
download | glibc-744eb12b7b0aa4ea0543e8dfd21b49bb5309bf93.zip glibc-744eb12b7b0aa4ea0543e8dfd21b49bb5309bf93.tar.gz glibc-744eb12b7b0aa4ea0543e8dfd21b49bb5309bf93.tar.bz2 |
* posix/regcomp.c (lower_subexp): Do not optimize empty
subexpressions even with REG_NOSUB.
* posix/rxspencer/tests: Add a previously failing testcase.
Diffstat (limited to 'posix/regcomp.c')
-rw-r--r-- | posix/regcomp.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/posix/regcomp.c b/posix/regcomp.c index 1a5f795..a7112cf 100644 --- a/posix/regcomp.c +++ b/posix/regcomp.c @@ -1321,6 +1321,11 @@ lower_subexp (err, preg, node) bin_tree_t *op, *cls, *tree1, *tree; if (preg->no_sub + /* We do not optimize empty subexpressions, because otherwise we may + have bad CONCAT nodes with NULL children. This is obviously not + very common, so we do not lose much. An example that triggers + this case is the sed "script" /\(\)/x. */ + && node->left != NULL && (node->token.opr.idx >= 8 * sizeof (dfa->used_bkref_map) || !(dfa->used_bkref_map & (1 << node->token.opr.idx)))) return node->left; |