RFR: JDK-8296995: ostream should handle snprintf(3) errors in release builds [v2]

Thomas Stuefe stuefe at openjdk.org
Wed Dec 7 13:46:05 UTC 2022


On Wed, 7 Dec 2022 11:58:30 GMT, Martin Doerr <mdoerr at openjdk.org> wrote:

>> Thomas Stuefe has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains one additional commit since the last revision:
>> 
>>   JDK-8296995-ostream-handle-sprintf-errors
>
> test/hotspot/gtest/utilities/test_ostream.cpp line 130:
> 
>> 128:   ::memset(buf, 'X', sizeof(buf));
>> 129:   int n = ::snprintf(buf + 1, sizeof(buf) - 2, "HALLO %ls", w);
>> 130:   if (n == -1) { // yes, we get an error. Retry using stringStream.
> 
> Can it happen that we don't get an error, here? If so, the ASSERT below still expects one, so, the test will fail. Correct?

Good catch. I added the death test afterwards. I'll fix it.

-------------

PR: https://git.openjdk.org/jdk/pull/11160


More information about the hotspot-dev mailing list