changeset 3522:1bc0c1354c4d

7166498: JVM crash in ClassVerifier Summary: Fixed raw pointer being used after potential safepoint/GC Reviewed-by: acorn, fparain, dholmes
author kamg
date Mon, 04 Jun 2012 10:22:37 -0400
parents 2c04ea9341f9
children 168536dbae60
files src/share/vm/classfile/verifier.cpp
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/classfile/verifier.cpp	Wed Jun 06 05:21:56 2012 +0200
+++ b/src/share/vm/classfile/verifier.cpp	Mon Jun 04 10:22:37 2012 -0400
@@ -1738,10 +1738,14 @@
   int target = bci + default_offset;
   stackmap_table->check_jump_target(current_frame, target, CHECK_VERIFY(this));
   for (int i = 0; i < keys; i++) {
+    // Because check_jump_target() may safepoint, the bytecode could have
+    // moved, which means 'aligned_bcp' is no good and needs to be recalculated.
+    aligned_bcp = (address)round_to((intptr_t)(bcs->bcp() + 1), jintSize);
     target = bci + (jint)Bytes::get_Java_u4(aligned_bcp+(3+i*delta)*jintSize);
     stackmap_table->check_jump_target(
       current_frame, target, CHECK_VERIFY(this));
   }
+  NOT_PRODUCT(aligned_bcp = NULL);  // no longer valid at this point
 }
 
 bool ClassVerifier::name_in_supers(