From: Jim Meyering Date: Mon, 27 Dec 2010 23:19:56 +0000 (-0500) Subject: Fix infloop on persistent failing calloc in regex. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=73c7d579597df7ccad82fbc231ad15b507a7db72;p=thirdparty%2Fglibc.git Fix infloop on persistent failing calloc in regex. (cherry picked from commit 2543fef229599e8a6e4feeea65ca2dd3f984154f) --- diff --git a/ChangeLog b/ChangeLog index 133bf3ce9ea..9413d111b48 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-12-27 Jim Meyering + + [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 [BZ #12207] diff --git a/posix/regexec.c b/posix/regexec.c index 8481b618dab..5019003c39a 100644 --- a/posix/regexec.c +++ b/posix/regexec.c @@ -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;