regcomp.c: do not ignore memory allocation failure

This commit is contained in:
Paul Eggert 2010-01-14 21:35:15 -08:00 committed by Ulrich Drepper
parent 0b689682ad
commit 21f5de55ec
2 changed files with 62 additions and 55 deletions

View File

@ -1,5 +1,10 @@
2010-01-14 Ulrich Drepper <drepper@redhat.com>
[BZ #11127]
* posix/regcomp.c (alc_eclosure_iter): Do not ignore
re_node_set_insert failure; return REG_ESPACE.
Patch by Paul Eggert.
* bits/confname.h: Make pre-C99-safe.
2010-01-14 Ryan S. Arnold <rsa@us.ibm.com>

View File

@ -1,6 +1,5 @@
/* Extended regular expression matching and search library.
Copyright (C) 2002,2003,2004,2005,2006,2007,2009
Free Software Foundation, Inc.
Copyright (C) 2002-2007,2009,2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
@ -1643,9 +1642,10 @@ static reg_errcode_t
calc_eclosure_iter (re_node_set *new_set, re_dfa_t *dfa, int node, int root)
{
reg_errcode_t err;
int i, incomplete;
int i;
re_node_set eclosure;
incomplete = 0;
int ret;
int incomplete = 0;
err = re_node_set_alloc (&eclosure, dfa->edests[node].nelem + 1);
if (BE (err != REG_NOERROR, 0))
return err;
@ -1700,8 +1700,10 @@ calc_eclosure_iter (re_node_set *new_set, re_dfa_t *dfa, int node, int root)
}
}
/* Epsilon closures include itself. */
re_node_set_insert (&eclosure, node);
/* An epsilon closure includes itself. */
ret = re_node_set_insert (&eclosure, node);
if (BE (ret < 0, 0))
return REG_ESPACE;
if (incomplete && !root)
dfa->eclosures[node].nelem = 0;
else