RFR: JDK-8153781 Issue in XMLScanner: EXPECTED_SQUARE_BRACKET_TO_CLOSE_INTERNAL_SUBSET when skipping large DOCTYPE section with CRLF at wrong place

Langer, Christoph christoph.langer at sap.com
Thu Apr 7 20:45:15 UTC 2016


I've run into a peculiar issue with Xerces.

The problem is happening when a DTD shall be skipped, the DTD is larger than the buffer of the current entity and a CRLF sequence occurs just one char before the buffer end.

The reason is that method skipDTD of class XMLDTDScannerImpl (about line 389) calls XMLEntityScanner.scanData() to scan for the next occurrence of ']'. The scanData method might return true which indicates that the delimiter ']' was not found yet and more data is to scan. Other users of scanData would handle this and call this method in a loop until it returns false or some other condition happens. So I've fixed that place like at the other callers of scanData.

Nevertheless, the scanData method would usually load more data when it is at the end of the buffer. But in the special case when CRLF is found at the end of buffer - 1, scanData would just return true. So I also removed that check at line 1374 in XMLEntityScanner. Do you see any problem with that? Is there any reason behind it which I'm overseeing?

Furthermore I took the chance for further little cleanups. I've added the new copyright header to the files... is that the correct one?

I also aligned the calls to invokeListeners(position) in XMLEntityScanner to always pass the actual position from which the load is started. Do you think this is correct?

Here is the bug:


Here is the webrev:


Please give me some comments before I finalize my change including a jtreg testcase.

Thanks & Best regards


More information about the core-libs-dev mailing list