]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Fix infloop on persistent failing calloc in regex.
authorJim Meyering <meyering@redhat.com>
Mon, 27 Dec 2010 23:19:56 +0000 (18:19 -0500)
committerPetr Baudis <pasky@suse.cz>
Thu, 3 Feb 2011 16:25:46 +0000 (17:25 +0100)
(cherry picked from commit 2543fef229599e8a6e4feeea65ca2dd3f984154f)

ChangeLog
posix/regexec.c

index 133bf3ce9ead7d91f8ab0910c5791cd3930a69b1..9413d111b484dfd383f6d0007192277d49ada02f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-12-27  Jim Meyering  <meyering@redhat.com>
+
+       [BZ #12348]
+       * posix/regexec.c (build_trtable): Return failure indication upon
+       calloc failure.  Otherwise, re_search_internal could infloop on OOM.
+
 2010-12-25  Ulrich Drepper  <drepper@gmail.com>
 
        [BZ #12207]
index 8481b618dab531596bd696ebefda8367d510c80b..5019003c39a03127123011d6983df5acd96b42c1 100644 (file)
@@ -3347,6 +3347,8 @@ build_trtable (const re_dfa_t *dfa, re_dfastate_t *state)
        {
          state->trtable = (re_dfastate_t **)
            calloc (sizeof (re_dfastate_t *), SBC_MAX);
+         if (BE (state->trtable == NULL, 0))
+           return 0;
          return 1;
        }
       return 0;