RFR: 8261031: Move some ClassLoader name checking to native/VM

Coleen Phillimore coleenp at openjdk.java.net
Thu Feb 4 13:16:43 UTC 2021


On Wed, 3 Feb 2021 19:49:30 GMT, Mandy Chung <mchung at openjdk.org> wrote:

>> This patch moves some sanity checking done in ClassLoader.java to the corresponding endpoints in native or VM code.
>
> src/java.base/share/native/libjava/ClassLoader.c line 291:
> 
>> 289:     }
>> 290:     // disallow slashes in input, change '.' to '/'
>> 291:     if (verifyFixClassname(clname)) {
> 
> perhaps we should replace all use of `fixClassname` with `verifyFixClassname` and remove `fixClassname`.

This suggestion makes sense to me.  verifyClassName is only used once in Class.c passing false so you could remove that argument.
It's hard to see how fixClassName then verifyClassname is equivalent to verifyFixClassname but verifyFixClassname makes more sense than verifyClassname.
I think this return:
    return (p != 0 && p - name == (ptrdiff_t)length);
implies a non-utf8 character was found?

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

PR: https://git.openjdk.java.net/jdk/pull/2378


More information about the core-libs-dev mailing list