RFR: 8256828: ostream::print_cr() truncates buffer in copy-through case [v3]
David Holmes
dholmes at openjdk.org
Tue Jun 4 07:05:10 UTC 2024
On Tue, 4 Jun 2024 04:36:30 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:
>> David Holmes has updated the pull request incrementally with one additional commit since the last revision:
>>
>> revert constexpr usage
>
> src/hotspot/share/utilities/ostream.cpp line 142:
>
>> 140: warning("outputStream::do_vsnprintf output truncated -- buffer length is " SIZE_FORMAT
>> 141: " bytes but " SIZE_FORMAT " bytes are needed.",
>> 142: add_cr ? buflen + 1 : buflen, required_len + 1);
>
> PrintWarnings defaults to true, right? Ah, I see, you limit to debug builds. Okay.
Yes same as before.
> test/hotspot/gtest/utilities/test_ostream.cpp line 147:
>
>> 145: va_list ap;
>> 146: va_start(ap, format);
>> 147: const char* res = tty->do_vsnprintf(buf, len, format, ap, add_cr, rlen);
>
> This was confusing at first glance. Any reason you use tty instead of just defaultStream::do_vsnprintf? Or, outputStream::do_vsnprintf?
Ha! OMG I never even noticed `do_vnsprintf` is static - everything else is an instance method so I used `tty`. Okay I can simplify this and move the test class to outputStream
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/19512#discussion_r1625453279
PR Review Comment: https://git.openjdk.org/jdk/pull/19512#discussion_r1625452545
More information about the hotspot-dev
mailing list