RFR: 8256828: ostream::print_cr() truncates buffer in copy-through case
David Holmes
dholmes at openjdk.org
Mon Jun 3 07:30:03 UTC 2024
On Mon, 3 Jun 2024 06:25:54 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:
>> Clarifies the behaviour of this function in regards to truncation when adding a CR. Ensures a truncation warning is always issued.
>>
>> Adds unit testing for the specialized cases.
>>
>> See JBS for discussion of other suggestions.
>>
>> Testing: - tiers 1-4
>>
>> Thanks
>
> src/hotspot/share/utilities/ostream.cpp line 109:
>
>> 107: result_len = buflen - 1;
>> 108: }
>> 109: } else if (format[0] == '%' && format[1] == 's' && format[2] == '\0') {
>
> nit, preexisting: why not just `strncmp(format, "%s", 3) == 0`?
Yep that works too. :)
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/19512#discussion_r1623904624
More information about the hotspot-dev
mailing list