regex: fix glibc bug 697
authorPaolo Bonzini <bonzini@gnu.org>
Fri, 9 Jan 2009 08:04:55 +0000 (09:04 +0100)
committerPaolo Bonzini <bonzini@gnu.org>
Fri, 9 Jan 2009 10:16:40 +0000 (11:16 +0100)
2009-01-09  Paolo Bonzini  <bonzini@gnu.org>

* lib/regexec.c (prune_impossible_nodes): Handle sifted_states[0]
being NULL also if there are no backreferences.

ChangeLog
lib/regexec.c

index 2059b0359761a14af4a1db0bd62db2e733eaa5e6..fe1f703c8874ce3bf8ebd591f603d3cbb2185fbc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-01-09  Paolo Bonzini  <bonzini@gnu.org>
+
+       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  <bonzini@gnu.org>
 
        regex: merge glibc changes
index 2afa5b387976e1caad983c076289a96abfdc2114..21a81669f25ea53ec4752d853b3409bd0ffbe068 100644 (file)
@@ -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 <isamu@yamato.ibm.com>.
 
@@ -1045,6 +1045,11 @@ prune_impossible_nodes (re_match_context_t *mctx)
       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;