RFR: 8338257: UTF8 lengths should be size_t not int [v5]
Dean Long
dlong at openjdk.org
Tue Aug 27 07:34:03 UTC 2024
On Tue, 27 Aug 2024 07:07:11 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> src/hotspot/share/classfile/javaClasses.cpp line 307:
>>
>>> 305: {
>>> 306: ResourceMark rm;
>>> 307: size_t utf8_len = static_cast<size_t>(length);
>>
>> I think there should be an assert that length is not negative, probably at the very beginning of this function.
>
> Why? As I explained to Coleen this is the length obtained from a Java array. All of the existing code relies on length being >= 0 and doesn't assert that anywhere.
If called from jni_NewString --> java_lang_String::create_oop_from_unicode, there's no Java String yet. Yes, it has probably been like this forever.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20560#discussion_r1732297010
More information about the serviceability-dev
mailing list