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

Coleen Phillimore coleenp at openjdk.org
Tue Sep 3 14:57:19 UTC 2024


On Mon, 2 Sep 2024 00:40:54 GMT, David Holmes <dholmes 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?

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

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


More information about the hotspot-dev mailing list