提交 82a5c12b 编写于 作者: K ksrini

8007902: [unpack200] incorrect BootstrapMethods attribute

Reviewed-by: jjh
上级 6c43c5ee
...@@ -4758,8 +4758,8 @@ int unpacker::write_bsms(int naOffset, int na) { ...@@ -4758,8 +4758,8 @@ int unpacker::write_bsms(int naOffset, int na) {
PTRLIST_QSORT(cp.requested_bsms, outputEntry_cmp); PTRLIST_QSORT(cp.requested_bsms, outputEntry_cmp);
// append the BootstrapMethods attribute (after the InnerClasses attr): // append the BootstrapMethods attribute (after the InnerClasses attr):
putref(cp.sym[cpool::s_BootstrapMethods]); putref(cp.sym[cpool::s_BootstrapMethods]);
// make a note of the offset, for lazy patching
int sizeOffset = (int)wpoffset(); int sizeOffset = (int)wpoffset();
byte* sizewp = wp;
putu4(-99); // attr size will be patched putu4(-99); // attr size will be patched
putu2(cur_class_local_bsm_count); putu2(cur_class_local_bsm_count);
int written_bsms = 0; int written_bsms = 0;
...@@ -4776,6 +4776,7 @@ int unpacker::write_bsms(int naOffset, int na) { ...@@ -4776,6 +4776,7 @@ int unpacker::write_bsms(int naOffset, int na) {
written_bsms += 1; written_bsms += 1;
} }
assert(written_bsms == cur_class_local_bsm_count); // else insane 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 putu4_at(sizewp, (int)(wp - (sizewp+4))); // size of code attr
putu2_at(wp_at(naOffset), ++na); // increment class attr count putu2_at(wp_at(naOffset), ++na); // increment class attr count
} }
......
/* /*
* 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -30,7 +30,7 @@ import java.util.jar.*; ...@@ -30,7 +30,7 @@ import java.util.jar.*;
/* /*
* @test * @test
* @bug 6521334 6712743 * @bug 6521334 6712743 8007902
* @summary check for memory leaks, test general packer/unpacker functionality\ * @summary check for memory leaks, test general packer/unpacker functionality\
* using native and java unpackers * using native and java unpackers
* @compile -XDignore.symbol.file Utils.java Pack200Test.java * @compile -XDignore.symbol.file Utils.java Pack200Test.java
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册