RFR: 8338257: UTF8 lengths should be size_t not int [v5]

Dean Long dlong at openjdk.org
Tue Aug 27 07:38:05 UTC 2024


On Tue, 27 Aug 2024 07:09:33 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> src/hotspot/share/classfile/javaClasses.cpp line 555:
>> 
>>> 553:   bool      is_latin1 = java_lang_String::is_latin1(java_string);
>>> 554: 
>>> 555:   if (length == 0) return nullptr;
>> 
>> Should this be checking for length <= 0?  It looks like length can indeed be negative if UTF8::unicode_length() tries to return the length of a utf8 string with length > 0x7fffffff.
>
> ??? length is assigned on line 552 and again comes from the length of a Java array.

OK.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/20560#discussion_r1732302004


More information about the hotspot-dev mailing list