Menu ▾ ▴

#4117 jEdit 5.6 cannot handle Unicode characers in mode files

minor bug
open
nobody
None
5
2022-03-30
2022-03-30
No

In 5.6 (worked fine in 5.5), I get an error when loading a mode that contains Unicode symbols, e.g., <seq type="OPERATOR">⊦</seq>. Pretty much any high Unicode character triggers the bug.

Inspecting the source code, I guess it should be Math.max instead of Math.min when increasing the size of the array.
(The array might get pretty big though.)
At the very least, parsing a single rule could fall back to ignoring the rule. Currently, loading the mode is aborted entirely, and no rules are loaded.

java.lang.ArrayIndexOutOfBoundsException: Index 8870 out of bounds for length 332
at org.gjt.sp.jedit.syntax.ParserRuleSet.addRule(ParserRuleSet.java:168)
at org.gjt.sp.jedit.syntax.ParserRuleSet.addRule(ParserRuleSet.java:144)
at org.gjt.sp.jedit.syntax.XModeHandler.endElement(XModeHandler.java:180)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.endNamespaceScope(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at org.gjt.sp.jedit.syntax.ModeProvider.loadMode(ModeProvider.java:399)
at org.gjt.sp.jedit.jEdit.loadMode(jEdit.java:3143)

Discussion


Log in to post a comment.