changeset 7464:520a3433883d

8007902: [unpack200] incorrect BootstrapMethods attribute Reviewed-by: jjh
author ksrini
date Sun, 10 Feb 2013 08:49:39 -0800
parents 58c95d0b6b1a
children 1df991184045
files src/share/native/com/sun/java/util/jar/pack/unpack.cpp test/tools/pack200/Pack200Test.java test/tools/pack200/pack200-verifier/data/golden.jar
diffstat 3 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/native/com/sun/java/util/jar/pack/unpack.cpp	Sun Feb 10 08:07:59 2013 -0800
+++ b/src/share/native/com/sun/java/util/jar/pack/unpack.cpp	Sun Feb 10 08:49:39 2013 -0800
@@ -4758,8 +4758,8 @@
     PTRLIST_QSORT(cp.requested_bsms, outputEntry_cmp);
     // append the BootstrapMethods attribute (after the InnerClasses attr):
     putref(cp.sym[cpool::s_BootstrapMethods]);
+    // make a note of the offset, for lazy patching
     int sizeOffset = (int)wpoffset();
-    byte* sizewp = wp;
     putu4(-99);  // attr size will be patched
     putu2(cur_class_local_bsm_count);
     int written_bsms = 0;
@@ -4776,6 +4776,7 @@
       written_bsms += 1;
     }
     assert(written_bsms == cur_class_local_bsm_count);  // else insane
+    byte* sizewp = wp_at(sizeOffset);
     putu4_at(sizewp, (int)(wp - (sizewp+4)));  // size of code attr
     putu2_at(wp_at(naOffset), ++na);  // increment class attr count
   }
--- a/test/tools/pack200/Pack200Test.java	Sun Feb 10 08:07:59 2013 -0800
+++ b/test/tools/pack200/Pack200Test.java	Sun Feb 10 08:49:39 2013 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,7 +30,7 @@
 
  /*
   * @test
-  * @bug 6521334 6712743
+  * @bug 6521334 6712743 8007902
   * @summary check for memory leaks, test general packer/unpacker functionality\
   *          using native and java unpackers
   * @compile -XDignore.symbol.file Utils.java Pack200Test.java
Binary file test/tools/pack200/pack200-verifier/data/golden.jar has changed