changeset 971:a00b66a274f2

Merge
author mfang
date Thu, 11 Jun 2015 11:39:22 -0700
parents 1c4d3cadfd38 a331502573b9
children 7d03050620d7 84f101872826
files
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/com/sun/org/apache/xerces/internal/impl/io/UTF8Reader.java	Thu Jun 11 11:39:02 2015 -0700
+++ b/src/com/sun/org/apache/xerces/internal/impl/io/UTF8Reader.java	Thu Jun 11 11:39:22 2015 -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) {