Skip to content

Commit f39e238

Browse files
committed
reinterpret_cast<> asserts
1 parent 12f8db6 commit f39e238

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/hotspot/share/classfile/classFileParser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3289,7 +3289,7 @@ void ClassFileParser::parse_classfile_bootstrap_methods_attribute(const ClassFil
32893289
// representing bootstrap specifiers:
32903290
// length*{bootstrap_method_index, argument_count, argument_count*{argument_index}}
32913291
const u4 attribute_tail_length = attribute_byte_length - static_cast<u4>(sizeof(u2));
3292-
3292+
assert(attribute_tail_length % sizeof(u2) == 0, "");
32933293
Array<u4>* const offsets =
32943294
MetadataFactory::new_array<u4>(_loader_data, num_bootstrap_methods, CHECK);
32953295
Array<u2>* const entries = // u2 data holding all the BSM attribute entries

src/hotspot/share/oops/constantPool.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,9 @@ class BSMAttributeEntry {
104104
// how to locate one of these inside a packed u2 data array:
105105
static BSMAttributeEntry* entry_at_offset(Array<u2>* entries, int offset) {
106106
assert(0 <= offset && offset+1 < entries->length(), "oob-1");
107-
// do not bother to copy u2 data; just overlay the struct within the array
108-
BSMAttributeEntry* bsme = (BSMAttributeEntry*)entries->adr_at(offset);
109-
assert(offset+1+bsme->argument_count() <= entries->length(), "oob-2");
107+
// Overlay the struct within the array
108+
BSMAttributeEntry* bsme = reinterpret_cast<BSMAttributeEntry*>(entries->adr_at(offset));
109+
assert(offset+1+bsme->argument_count() < entries->length(), "oob-2");
110110
return bsme;
111111
}
112112
friend class ConstantPool; // uses entry_at_offset

0 commit comments

Comments
 (0)