diff options
author | Ville Voutilainen <ville.voutilainen@gmail.com> | 2015-12-18 23:27:53 +0200 |
---|---|---|
committer | Ville Voutilainen <ville@gcc.gnu.org> | 2015-12-18 23:27:53 +0200 |
commit | ca2c1b328327f998338cfa4b9e902e439cf57278 (patch) | |
tree | a6ca74c0d9b00a74cfda105695db0fd9af079627 | |
parent | e8f47b663f39d4bc959ef181b0cb8ed935aa4c6d (diff) | |
download | gcc-ca2c1b328327f998338cfa4b9e902e439cf57278.zip gcc-ca2c1b328327f998338cfa4b9e902e439cf57278.tar.gz gcc-ca2c1b328327f998338cfa4b9e902e439cf57278.tar.bz2 |
Fix a regression introduced by the fix of libstdc++/68276.
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.
From-SVN: r231839
-rw-r--r-- | libstdc++-v3/ChangeLog | 6 | ||||
-rw-r--r-- | libstdc++-v3/src/c++11/ios.cc | 8 |
2 files changed, 13 insertions, 1 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index a37878d..c4f9f3c 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,11 @@ 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. + +2015-12-18 Ville Voutilainen <ville.voutilainen@gmail.com> + PR libstdc++/68276 * src/c++11/ios.cc (_M_grow_words): Use nothrow new. 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; |