From fce49af15699413e11762a9da82e3ba4a4c89c07 Mon Sep 17 00:00:00 2001 From: nathan Date: Thu, 12 Apr 2001 07:47:34 +0000 Subject: * 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 --- libstdc++-v3/libsupc++/eh_alloc.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'libstdc++-v3/libsupc++/eh_alloc.cc') 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)); -- cgit v1.2.1