RFR: 8241294: Examine input checking in ClassLoader::package_from_class_name
Lois Foltan
lois.foltan at oracle.com
Fri Mar 27 20:47:58 UTC 2020
On 3/27/2020 9:55 AM, Claes Redestad wrote:
> Hi,
>
> in ClassLoader::package_from_class_name, testing if the class name input
> is NULL is redundant, and testing for and skipping ['s is wrong, since
> fully qualified array class names doesn't start with [.
>
> We can also get rid of the bad_class_name parameter, and move
> the complexity of that checking to the only call site that distinguishes
> between an empty package NULL and a bad class name NULL
>
> Webrev: http://cr.openjdk.java.net/~redestad/8241294/open.00/
> Bug: https://bugs.openjdk.java.net/browse/JDK-8241294
>
> Testing: tier1-4 (ongoing)
>
> Thanks!
>
> /Claes
Hi Claes,
Looks good. I'm glad to be rid of that "bad_class_name" parameter.
Thank you for doing this. Minor comment:
- classfile/classLoader.cpp
line #180 & #188 - plase consider adding an improved comment over "Can't
be" in the asserts. Maybe
line #180 "unexpected null class name"
line #188 "class name's first character contains an array opening bracket"
Also, I was able to write a .jasm file with a class whose name is "[FOO"
for example. With your patch, I did try executing the resulting .class
file and am receiving a CNFE, "Could not find or load main class [FOO"
exception. If you would like the .jasm file I can mail it to you to
experiment more with.
Thanks,
Lois
More information about the hotspot-runtime-dev
mailing list