RFR: 8338888: SystemDictionary::class_name_symbol has incorrect length check
David Holmes
dholmes at openjdk.org
Mon Aug 26 12:23:04 UTC 2024
On Mon, 26 Aug 2024 12:13:38 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> src/hotspot/share/classfile/systemDictionary.cpp line 269:
>>
>>> 267: // To avoid internal snprintf INT_MAX limit we reduce the maximum length
>>> 268: // of name to print, by the length of the rest of the formatted message.
>>> 269: int print_limit = INT_MAX - 45;
>>
>> I was wondering where that "45" came from. It appears to be the length of the format string below,
>> including the format directives. That seems wrong. Doesn't it need to account for the *expansion*
>> of the "%d" directive?
>
> It does. It is the text up to the %s and the expanded %d which will be 65535, plus one. The plus one deals with a seeming off-by-one bug with macOS vsnprintf.
But I'm realizing now that this should not work ... it needs to account for the actual strlen of the name.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20709#discussion_r1731157581
More information about the hotspot-runtime-dev
mailing list