Details
-
Bug
-
Status: Reopened
-
Minor
-
Resolution: Unresolved
-
2.9.0
-
None
-
None
-
Any
Description
There is a ArrayOutOfBoundsException in org.apache.xerces.impl.io.UTF8Reader, in read(char[],int,int) for 4-byte utf-8 chars.
Imagine a following scenario. read() has a buffer of size N, and it reads N-1 ascii chars, and stores it in the output buffer. Let the Nth char be the first byte of a 4 byte utf-8 char. The other 3 bytes are fetched by invoking read() on the input stream. From these a surrogate pair of java chars is made, however, method does not check if both chars can fit into the output buffer ... In most cases, they would fit into the ouput buffer (e.g. if there are some other multi-byte chars in the fetched text), so the bug is very rare, but it still happens.
Attachments
Attachments
Issue Links
- is duplicated by
-
XERCESJ-1614 ArrayIndexOutOfBoundsException: 2048 and Invalid byte 2 of 4-byte UTF-8 sequence.
- Resolved
- is related to
-
XERCESJ-1668 Off-by-one bug w/ surrogates in UTF8Reader
- Open