# HG changeset patch # User Paolo Bonzini # Date 1231488295 -3600 # Node ID 7e353646d8a6fc7868c1c5729bc279a2565e06f4 # Parent cc7a1af3872f839a01af068ef8093d84bb7a244e regex: fix glibc bug 697 2009-01-09 Paolo Bonzini * lib/regexec.c (prune_impossible_nodes): Handle sifted_states[0] being NULL also if there are no backreferences. diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-01-09 Paolo Bonzini + + regex: fix glibc bug 697 + * lib/regexec.c (prune_impossible_nodes): Handle sifted_states[0] + being NULL also if there are no backreferences. + 2009-01-09 Paolo Bonzini regex: merge glibc changes diff --git a/lib/regexec.c b/lib/regexec.c --- a/lib/regexec.c +++ b/lib/regexec.c @@ -1,6 +1,6 @@ /* Extended regular expression matching and search library. - Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, - Inc. + Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 + Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Isamu Hasegawa . @@ -1045,6 +1045,11 @@ re_node_set_free (&sctx.limits); if (BE (ret != REG_NOERROR, 0)) goto free_return; + if (sifted_states[0] == NULL) + { + ret = REG_NOMATCH; + goto free_return; + } } re_free (mctx->state_log); mctx->state_log = sifted_states;