Bug #3866
closed
Failures running GitHub JSON test suite
Applies to branch:
9.8, trunk
Fix Committed on Branch:
9.8, trunk
Fixed in Maintenance Release:
Description
I have incorporated the JSON tests found at http://github.com/nst/JSONTestSuite into the QT3 test suite, and a few of the tests are failing. I'll use this issue tracker as an "umbrella" entry to report progress on fixing these problems.
Test n_string_single_doublequote crashes with java.lang.StringIndexOutOfBoundsException: String index out of range: 1
The test contains a single-character string, a double quote character.
Solution: in JSONParser.readToken, case '"', test the value of "position" at the start of the loop instead of the end.
Test n_structure_100000_opening_arrays crashes with a StackOverflowError because arrays are too deeply nested.
A JSON parser is allowed to impose limits, but we should try to fail cleanly.
Solution: wrap recursive calls of parseConstruct() in a try/catch that catches StackOverflowError, and produce a "too deeply nested" diagnostic.
Test -t:n_string_escaped_emoji crashes with "string index out of range". This test contains a backslash followed by a non-BMP character.
The crash actually occurs while reporting the syntax error. "Unknown escape sequence \X" where X is the high surrogate part of the non-BMP character.
The standard error listener tries to avoid putting non-Latin characters in error messages and is attempting to expand the character. It detects the presence of a non-BMP character and attempts to convert the string to a GeneralUnicodeString; this calls StringValue.expand() which trusts the supplied string to be well-formed and crashes because it contains an unpaired surrogate.
Decided to fix this at the point we generate the error message (in JsonParser and JsonReceiver)
- Status changed from New to Resolved
- Fix Committed on Branch 9.8, trunk added
- % Done changed from 0 to 100
- Fixed in Maintenance Release 9.9.0.1 added
Bug fix applied in the Saxon 9.9.0.1 major release.
Leave open until fix applied in the next Saxon 9.8 maintenance release.
- Status changed from Resolved to Closed
- Fixed in Maintenance Release 9.8.0.15 added
Bug fix applied in the Saxon 9.8.0.15 maintenance release.
Please register to edit this issue
Also available in: Atom
PDF