aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/src
diff options
context:
space:
mode:
authorVille Voutilainen <ville.voutilainen@gmail.com>2015-12-18 21:27:53 +0000
committerVille Voutilainen <ville.voutilainen@gmail.com>2015-12-18 21:27:53 +0000
commiteb1bdc74046e8143ed75051ca0e264d7044b542b (patch)
treea6ca74c0d9b00a74cfda105695db0fd9af079627 /libstdc++-v3/src
parentc8235e02d6a962ec5ad3643d422fd7804427ffe5 (diff)
2015-12-18 Ville Voutilainen <ville.voutilainen@gmail.com>
Fix a regression introduced by the fix of libstdc++/68276. * src/c++11/ios.cc (_M_grow_words): Catch bad_alloc again so that bad_array_new_length is handled properly. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@231839 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/src')
-rw-r--r--libstdc++-v3/src/c++11/ios.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/libstdc++-v3/src/c++11/ios.cc b/libstdc++-v3/src/c++11/ios.cc
index f701e61f0d0..17dad559573 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;