You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2009/06/17 11:47:29 UTC
svn commit: r785530 - in /commons/sandbox/runtime/trunk/src:
main/native/include/acr_error.h
test/org/apache/commons/runtime/TestDirectByteBuffer.java
Author: mturk
Date: Wed Jun 17 09:47:29 2009
New Revision: 785530
URL: http://svn.apache.org/viewvc?rev=785530&view=rev
Log:
Exception handler cannot deal with double free
Modified:
commons/sandbox/runtime/trunk/src/main/native/include/acr_error.h
commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestDirectByteBuffer.java
Modified: commons/sandbox/runtime/trunk/src/main/native/include/acr_error.h
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/acr_error.h?rev=785530&r1=785529&r2=785530&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/acr_error.h (original)
+++ commons/sandbox/runtime/trunk/src/main/native/include/acr_error.h Wed Jun 17 09:47:29 2009
@@ -67,15 +67,15 @@
#ifdef ACR_WANT_MEMPROTECT
#ifdef _MSC_VER
#define SEH_ERROR GetExceptionCode()
+static int _seh_error = 0;
#define ACR_TRY \
- int _seh_error = 0; \
if (ACR_GetExceptionHandlerMode() != ACR_SEH_NONE) \
_seh_error = 1; \
- __try {
+ __try
#define ACR_CATCH() \
- } __except(_seh_error ? EXCEPTION_EXECUTE_HANDLER : \
- EXCEPTION_CONTINUE_SEARCH)
+ __except(_seh_error ? EXCEPTION_EXECUTE_HANDLER : \
+ EXCEPTION_CONTINUE_SEARCH)
#else
#include <signal.h>
Modified: commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestDirectByteBuffer.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestDirectByteBuffer.java?rev=785530&r1=785529&r2=785530&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestDirectByteBuffer.java (original)
+++ commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestDirectByteBuffer.java Wed Jun 17 09:47:29 2009
@@ -86,11 +86,12 @@
assertTrue("Direct", bb.isDirect());
assertEquals("Capacity", 1000, bb.capacity());
try {
- Native.enableExceptionHandler();
- ptr.free();
+ boolean test_me = false;
+ Native.enableExceptionHandler();
+ ptr.free();
// This is double free. Don't do this!
- if (OS.TYPE.contains(OsType.WINDOWS)) {
- // TODO: Check for MALLOC_CHECK_ envvar.
+ // Exception handler won't help here.
+ if (test_me) {
DirectByteBuffer.free(bb);
}
} catch (Throwable t) {