Message ID | CAFk2RUbvMAx_95z5wGyFzN21PheLKRMHN2ia2=+7G25oPiv6nA@mail.gmail.com |
---|---|
State | New |
Headers | show |
On 18/12/15 21:59 +0200, Ville Voutilainen wrote: >Here's a fix for the regression that the patch introduced. Tested with >-m32 on Linux-X64. OK, thanks for the quick turnaround.
diff --git a/libstdc++-v3/src/c++11/ios.cc b/libstdc++-v3/src/c++11/ios.cc index f701e61..17dad55 100644 --- a/libstdc++-v3/src/c++11/ios.cc +++ b/libstdc++-v3/src/c++11/ios.cc @@ -121,7 +121,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION if (__ix < numeric_limits<int>::max()) { __newsize = __ix + 1; - __words = new (std::nothrow) _Words[__newsize]; + /* We still need to catch bad_alloc even though we use + a nothrow new, because the new-expression can throw + a bad_array_new_length. */ + __try + { __words = new (std::nothrow) _Words[__newsize]; } + __catch(const std::bad_alloc&) + { __words = nullptr; } if (!__words) { _M_streambuf_state |= badbit;