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 09:45:22 UTC

svn commit: r785499 - /commons/sandbox/runtime/trunk/src/main/native/shared/pointer.c

Author: mturk
Date: Wed Jun 17 07:45:22 2009
New Revision: 785499

URL: http://svn.apache.org/viewvc?rev=785499&view=rev
Log:
Protect memory access

Modified:
    commons/sandbox/runtime/trunk/src/main/native/shared/pointer.c

Modified: commons/sandbox/runtime/trunk/src/main/native/shared/pointer.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/pointer.c?rev=785499&r1=785498&r2=785499&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/pointer.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/pointer.c Wed Jun 17 07:45:22 2009
@@ -21,6 +21,7 @@
 
 #include "acr.h"
 #include "acr_private.h"
+#define  ACR_WANT_MEMPROTECT
 #include "acr_error.h"
 #include "acr_clazz.h"
 #include "acr_pointer.h"
@@ -190,14 +191,22 @@
                                     jniptr d, jniptr l)
 {
     UNREFERENCED_STDARGS;
-    memcpy(N2P(d, void *), N2P(s, const void *), (size_t)l);
+    ACR_TRY {
+        memcpy(N2P(d, void *), N2P(s, const void *), (size_t)l);
+    } ACR_CATCH() {
+        ACR_ThrowException(_E, THROW_NMARK, ACR_EX_ERUNTIME, EFAULT);
+    }
 }
 
 ACR_PTR_EXPORT_DECLARE(void, move0)(ACR_JNISTDARGS, jniptr s,
                                     jniptr d, jniptr l)
 {
     UNREFERENCED_STDARGS;
-    memmove(N2P(d, void *), N2P(s, const void *), (size_t)l);
+    ACR_TRY {
+        memmove(N2P(d, void *), N2P(s, const void *), (size_t)l);
+    } ACR_CATCH() {
+        ACR_ThrowException(_E, THROW_NMARK, ACR_EX_ERUNTIME, EFAULT);
+    }
 }
 
 ACR_DECLARE(jobject) ACR_PointerCreate(JNIEnv *_E, void *p, size_t len,