You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by wr...@apache.org on 2006/03/18 02:23:08 UTC
svn commit: r386781 - /apr/apr/branches/1.2.x/locks/win32/thread_mutex.c
Author: wrowe
Date: Fri Mar 17 17:23:06 2006
New Revision: 386781
URL: http://svn.apache.org/viewcvs?rev=386781&view=rev
Log:
Close a kernel layer segfault when the user attempts to lock
a critical section after DeleteCriticalSection() has been
invoked. There is no protection in the lock/unlock kernel
code, so ensure we don't enter the critical section path at
all with deleted mutex, and fail instead by attempting to
wait on a bad handle, resulting in a less drastic failure.
Backports: 386780
Modified:
apr/apr/branches/1.2.x/locks/win32/thread_mutex.c
Modified: apr/apr/branches/1.2.x/locks/win32/thread_mutex.c
URL: http://svn.apache.org/viewcvs/apr/apr/branches/1.2.x/locks/win32/thread_mutex.c?rev=386781&r1=386780&r2=386781&view=diff
==============================================================================
--- apr/apr/branches/1.2.x/locks/win32/thread_mutex.c (original)
+++ apr/apr/branches/1.2.x/locks/win32/thread_mutex.c Fri Mar 17 17:23:06 2006
@@ -28,6 +28,7 @@
apr_thread_mutex_t *lock = data;
if (lock->type == thread_mutex_critical_section) {
+ lock->type = -1;
DeleteCriticalSection(&lock->section);
}
else {
@@ -60,8 +61,8 @@
* use a [slower] mutex object, instead.
*/
IF_WIN_OS_IS_UNICODE {
- (*mutex)->type = thread_mutex_critical_section;
InitializeCriticalSection(&(*mutex)->section);
+ (*mutex)->type = thread_mutex_critical_section;
}
#endif
#if APR_HAS_ANSI_FS