diff options
author | Nathan Sidwell <nathan@codesourcery.com> | 2001-04-12 07:47:34 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2001-04-12 07:47:34 +0000 |
commit | f847167e3d5c4864f64bd950a6a0d478a6730def (patch) | |
tree | 61705408bb09241d14f3b569651666fefb360e9b | |
parent | 0fb3018cd802d7aae15888ba68f51ad9a83cb71d (diff) | |
download | gcc-f847167e3d5c4864f64bd950a6a0d478a6730def.zip gcc-f847167e3d5c4864f64bd950a6a0d478a6730def.tar.gz gcc-f847167e3d5c4864f64bd950a6a0d478a6730def.tar.bz2 |
eh_alloc.cc (__cxa_allocate_exception): Don't terminate holding the mutex.
* libsupc++/eh_alloc.cc (__cxa_allocate_exception): Don't
terminate holding the mutex. Make sure size fits in EMERGENCY_OBJ_SIZE.
From-SVN: r41296
-rw-r--r-- | libstdc++-v3/ChangeLog | 5 | ||||
-rw-r--r-- | libstdc++-v3/libsupc++/eh_alloc.cc | 7 |
2 files changed, 11 insertions, 1 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 588e8d8..50cf9ec 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,8 @@ +2001-04-12 Nathan Sidwell <nathan@codesourcery.com> + + * libsupc++/eh_alloc.cc (__cxa_allocate_exception): Don't + terminate holding the mutex. Make sure size fits in EMERGENCY_OBJ_SIZE. + 2001-04-12 Gabriel Dos Reis <gdr@codesourcery.com> * testsuite/README: Add DejaGnu specific documentation. diff --git a/libstdc++-v3/libsupc++/eh_alloc.cc b/libstdc++-v3/libsupc++/eh_alloc.cc index 61dc75d..bbaa6f6 100644 --- a/libstdc++-v3/libsupc++/eh_alloc.cc +++ b/libstdc++-v3/libsupc++/eh_alloc.cc @@ -113,19 +113,24 @@ __cxa_allocate_exception(std::size_t thrown_size) bitmask_type used = emergency_used; unsigned int which = 0; + if (thrown_size > EMERGENCY_OBJ_SIZE) + goto failed; while (used & 1) { used >>= 1; if (++which >= EMERGENCY_OBJ_COUNT) - std::terminate (); + goto failed; } emergency_used |= (bitmask_type)1 << which; ret = &emergency_buffer[which][0]; + failed:; #ifdef __GTHREADS __gthread_mutex_unlock (&emergency_mutex); #endif + if (!ret) + std::terminate (); } memset (ret, 0, sizeof (__cxa_exception)); |