flexmark-java icon indicating copy to clipboard operation
flexmark-java copied to clipboard

Certain phrase causing StringIndexOutOfBoundsException

Open fiveoaksmn opened this issue 2 years ago • 0 comments

Describe the bug A clear and concise description of what the bug is.

  • [X] Parser
  • [ ] HtmlRenderer
  • [ ] Formatter
  • [ ] FlexmarkHtmlParser
  • [ ] DocxRenderer
  • [ ] PdfConverterExtension
  • [x] extension(s)

To Reproduce

When I attempt to parse the below markdown phrase:

Hello **World**!

I get the following exception:

java.lang.StringIndexOutOfBoundsException: String index: 16 out of range: [0, 16)
	com.vladsch.flexmark.util.sequence.SequenceUtils.validateIndex(SequenceUtils.java:1143)
	com.vladsch.flexmark.util.sequence.SubSequence.charAt(SubSequence.java:113)
	com.vladsch.flexmark.ext.resizable.image.internal.ResizableImageInlineParserExtension.parse(ResizableImageInlineParserExtension.java:33)
	com.vladsch.flexmark.parser.internal.InlineParserImpl.parseInline(InlineParserImpl.java:368)
	com.vladsch.flexmark.parser.internal.InlineParserImpl.parse(InlineParserImpl.java:169)
	com.vladsch.flexmark.parser.core.ParagraphParser.parseInlines(ParagraphParser.java:64)
	com.vladsch.flexmark.parser.internal.DocumentParser.processInlines(DocumentParser.java:750)
	com.vladsch.flexmark.parser.internal.DocumentParser.finalizeAndProcess(DocumentParser.java:1005)
	com.vladsch.flexmark.parser.internal.DocumentParser.parse(DocumentParser.java:312)
	com.vladsch.flexmark.parser.Parser.parse(Parser.java:388)

The code I am running that produces this is:

Node document = parser.parse( input );

If I remove the ! at the end of the string, it works. Having the ! at the end should be valid.

fiveoaksmn avatar Nov 06 '22 21:11 fiveoaksmn