summaryrefslogtreecommitdiff
path: root/libstdc++-v3/libsupc++/eh_alloc.cc
diff options
context:
space:
mode:
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2001-04-12 07:47:34 +0000
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2001-04-12 07:47:34 +0000
commitfce49af15699413e11762a9da82e3ba4a4c89c07 (patch)
tree61705408bb09241d14f3b569651666fefb360e9b /libstdc++-v3/libsupc++/eh_alloc.cc
parenta201f10a506699835bda97b35aa0adb7b94880f8 (diff)
downloadgcc-fce49af15699413e11762a9da82e3ba4a4c89c07.tar.gz
* libsupc++/eh_alloc.cc (__cxa_allocate_exception): Don't
terminate holding the mutex. Make sure size fits in EMERGENCY_OBJ_SIZE. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@41296 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/libsupc++/eh_alloc.cc')
-rw-r--r--libstdc++-v3/libsupc++/eh_alloc.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/libstdc++-v3/libsupc++/eh_alloc.cc b/libstdc++-v3/libsupc++/eh_alloc.cc
index 61dc75d159b..bbaa6f694a0 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));