On Thu, 4 Feb 2021 13:11:47 GMT, Coleen Phillimore <cole...@openjdk.org> wrote:
>> 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? Actually I think replacing fixClassName with verifyFixClassname will be awkward since the latter returns a value that's not checked in all the callers of fixClassName. Maybe you could write fixClassName as: void fixClassName() { verifyFixClassName(); with some assertion it passed? } ------------- PR: https://git.openjdk.java.net/jdk/pull/2378