RFR: JDK-8039751: UTF-8 decoder fails to handle some edge cases correctly

Xueming Shen xueming.shen at oracle.com
Wed Apr 9 21:51:53 UTC 2014


Please help review the fix for JDK-8039751.

Issue:     https://bugs.openjdk.java.net/browse/JDK-8039751
webrev:  http://cr.openjdk.java.net/~sherman/8039751/webrev/

This is the corner case (in 4 bytes sequence) we missed when fixing 7096080 [1].
The UTF_8 decoder correctly returns the malformed length for some malformed
4-byte illegal byte sequence (via Decoder.malformedN(...)), but it fails to do so if
there is no enough (< 4 bytes) bytes in input buffer (via isMalfromed4_2(...))

The proposed change fixes these corner cases.

Hey Mark, my reading of tomcat's test case suggests "malformed 4-byte sequence"
is the only thing left after the jdk8 fix, right?


[1] https://bugs.openjdk.java.net/browse/JDK-7096080

More information about the core-libs-dev mailing list