RFR (s) 8158906: JShell: crashes with extremely long result value
Robert Field
robert.field at oracle.com
Fri Aug 19 15:55:27 UTC 2016
Thanks shinyafox!
Testing string length doesn't cover actual encoded UTF-8 length. Which can
be four bytes. I should include a test with four bytes. And the check
should be correspondingly for a smaller number.
Thanks,
Robert
On August 19, 2016 7:22:34 AM ShinyaYoshida <bitterfoxc at gmail.com> wrote:
> Hi Robert,
> I think there is still the problem for Japanese(or Chinese?).
>
> Could you try this test case?
> public void testLongRemoteJapaneseStrings() { //8158906
> assertEval("import java.util.stream.*;");
> assertEval("String m(int x) { return Stream.generate(() ->
> \"\u3042\").limit(x).collect(Collectors.joining()); }");
> boolean[] shut = new boolean[1];
> getState().onShutdown(j -> {shut[0] = true;} );
> List<SnippetEvent> el = assertEval("m(65600);");
> assertTrue(shut[0] == false, "JShell died with long value");
> assertEquals(el.size(), 1, "Excepted one event");
> assertTrue(el.get(0).value().length() > 30000,
> "Expected truncated but long String, got: " +
> el.get(0).value());
> }
>
> "\u3042" is the first japanese character, あ(a) and it could be 3 bytes in
> utf-8.
> (
> https://docs.oracle.com/javase/8/docs/api/java/io/DataOutput.html#writeUTF-java.lang.String-
> )
> I think it isn't yet resolved due to your code limit String to about 30000
> characters.
> i.e. the byte on the stream is still over about 60000.
>
> If the test case pass, LGTM!
>
> Regards,
> shinyafox(Shinya Yoshida)
>
>
> 2016-08-19 10:15 GMT+09:00 Robert Field <robert.field at oracle.com>:
>
>> Please review...
>>
>> Bug:
>> https://bugs.openjdk.java.net/browse/JDK-8158906
>>
>> Webrev:
>> http://cr.openjdk.java.net/~rfield/8158906v0.webrev/
>>
>> Thanks,
>> Robert
>>
>>
More information about the kulla-dev
mailing list