PING: 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
Mon Apr 11 14:47:45 UTC 2016


Hi,

Ping: Any comments on my changes?

Thanks
Christoph

From: Langer, Christoph
Sent: Donnerstag, 7. April 2016 22:45
To: core-libs-dev at openjdk.java.net
Subject: RFR: JDK-8153781 Issue in XMLScanner: EXPECTED_SQUARE_BRACKET_TO_CLOSE_INTERNAL_SUBSET when skipping large DOCTYPE section with CRLF at wrong place

Hi,

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:
https://bugs.openjdk.java.net/browse/JDK-8153781

Here is the webrev:
http://cr.openjdk.java.net/~clanger/webrevs/8153781.0/

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

Thanks & Best regards
Christoph




More information about the core-libs-dev mailing list