8219196: DataOutputStream.writeUTF may throw unexpected exceptions

Roger Riggs Roger.Riggs at oracle.com
Fri Mar 15 19:57:35 UTC 2019

Hi Brian,

Looks ok.

In the test, you could probably create the string using.

Instead of disabling the test statically, you could make it conditional
on Runtime.maxMemory but the test will fail quickly anyway.


Can you fix the indent lines 387-389, it seems to be only 3 chars.

Regards, Roger

On 03/15/2019 03:40 PM, Martin Buchholz wrote:
> Consider changing utflen to a long.
> On Fri, Mar 15, 2019 at 12:25 PM Brian Burkhalter <
> brian.burkhalter at oracle.com> wrote:
>> For [1] please review the proposed fix [2]. It is possible to preemptively
>> detect a sufficient condition for when the length of the modified UTF-8
>> encoding of the string parameter will exceed the maximum allowed value and
>> thereby avert any numerical overflow in incrementing the accumulator which
>> counts the number of encoded characters.
>> Thanks,
>> Brian
>> [1] https://bugs.openjdk.java.net/browse/JDK-8219196
>> [2] http://cr.openjdk.java.net/~bpb/8219196/webrev.00/

More information about the core-libs-dev mailing list