changeset 659:6c6b34477e93 jdk9-b38

Merge
author lana
date Thu, 30 Oct 2014 13:56:49 -0700
parents a2bbbdef34e7 f697052647e3
children 0bb3cf8b2973 4ffb47fda7bb
files
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/io/UTF8Reader.java	Thu Oct 30 08:34:59 2014 -0700
+++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/io/UTF8Reader.java	Thu Oct 30 13:56:49 2014 -0700
@@ -529,6 +529,16 @@
                     invalidByte(4, 4, b2);
                 }
 
+                // check if output buffer is large enough to hold 2 surrogate chars
+                if (out + 1 >= ch.length) {
+                    fBuffer[0] = (byte)b0;
+                    fBuffer[1] = (byte)b1;
+                    fBuffer[2] = (byte)b2;
+                    fBuffer[3] = (byte)b3;
+                    fOffset = 4;
+                    return out - offset;
+                }
+
                 // decode bytes into surrogate characters
                 int uuuuu = ((b0 << 2) & 0x001C) | ((b1 >> 4) & 0x0003);
                 if (uuuuu > 0x10) {