RFR: 8339316: Test runtime/exceptionMsgs/NoClassDefFoundError/NoClassDefFoundErrorTest.java fails after JDK-8338257

David Holmes dholmes at openjdk.org
Tue Sep 3 21:47:19 UTC 2024


On Tue, 3 Sep 2024 14:54:51 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> In JDK-8338257 I overlooked updating the callers of `UTF8::is_legal_utf8` to pass a `size_t` length parameter. In some cases the length was explicitly cast to `int` and in the test case in question (with `-Xcheck:jni`) this caused integer overflow to a negative value which then became an exceedingly large `size_t` value and we then tried to do utf8 validation on random bytes.
>> 
>> Testing:
>> - failing test
>> - tiers 1-4
>> 
>> Thanks
>
> src/hotspot/share/classfile/systemDictionary.cpp line 288:
> 
>> 286:   }
>> 287:   // Callers should ensure that the name is never an illegal UTF8 string.
>> 288:   assert(UTF8::is_legal_utf8((const unsigned char*)name, name_len, false),
> 
> Is there where the > INT_MAX length got in from JNI?

No, the failing path was in jniCheck.cpp. In this code we have already rejected strings > `Symbol::max_length`.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20804#discussion_r1742730181


More information about the hotspot-dev mailing list