RFR: 8339460: CDS error when module is located in a directory with space in the name
Maxim Kartashev
mkartashev at openjdk.org
Tue Sep 24 05:25:35 UTC 2024
On Mon, 23 Sep 2024 22:46:41 GMT, Calvin Cheung <ccheung at openjdk.org> wrote:
>> The crux of the problem is that path names in CDS are saved as URIs and subsequently "converted" back to path names simply by stripping off the prefix without appropriate conversion of the rest of the name. This commit adds such a conversion.
>
> src/hotspot/share/classfile/classLoader.cpp line 1236:
>
>> 1234: if (str[index] == '%'
>> 1235: && isxdigit(str[index + 1])
>> 1236: && isxdigit(str[index + 2])) {
>
> I think you need to bound check the index because the `uri` from `ClassLoaderExt::process_module_table `could just be a directory name, e.g. dir%, without the jar file name.
`str` is still zero-terminated, so if `str[index] == '%'` is true, then `str[index + 1]` at least exists and might be `0`. If `isxdigit(str[index + 1])` is true then `str[index + 2]` at least exists and might be `0`, in which case `isxdigit()` is going to be false for it.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20987#discussion_r1772621434
More information about the hotspot-runtime-dev
mailing list