hotspot/src/share/vm/prims/unsafe.cpp
changeset 14127 16ba0a8dfde2
parent 13952 e3cf184080bc
child 14488 ab48109f7d1b
--- a/hotspot/src/share/vm/prims/unsafe.cpp	Wed Oct 17 12:09:32 2012 -0700
+++ b/hotspot/src/share/vm/prims/unsafe.cpp	Thu Oct 18 07:06:31 2012 -0700
@@ -124,6 +124,8 @@
       assert((void*)p->obj_field_addr<oop>((jint)byte_offset) == ptr_plus_disp,
              "raw [ptr+disp] must be consistent with oop::field_base");
     }
+    jlong p_size = HeapWordSize * (jlong)(p->size());
+    assert(byte_offset < p_size, err_msg("Unsafe access: offset " INT64_FORMAT " > object's size " INT64_FORMAT, byte_offset, p_size));
   }
 #endif
   if (sizeof(char*) == sizeof(jint))    // (this constant folds!)