apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject svn commit: r386780 - /apr/apr/trunk/locks/win32/thread_mutex.c
Date Sat, 18 Mar 2006 01:22:38 GMT
Author: wrowe
Date: Fri Mar 17 17:22:36 2006
New Revision: 386780

URL: http://svn.apache.org/viewcvs?rev=386780&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.

Modified:
    apr/apr/trunk/locks/win32/thread_mutex.c

Modified: apr/apr/trunk/locks/win32/thread_mutex.c
URL: http://svn.apache.org/viewcvs/apr/apr/trunk/locks/win32/thread_mutex.c?rev=386780&r1=386779&r2=386780&view=diff
==============================================================================
--- apr/apr/trunk/locks/win32/thread_mutex.c (original)
+++ apr/apr/trunk/locks/win32/thread_mutex.c Fri Mar 17 17:22:36 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



Mime
View raw message