dart-lang / markdown

A Dart markdown library
https://pub.dev/packages/markdown
BSD 3-Clause "New" or "Revised" License
455 stars 200 forks source link

Crash "Bad state: No element" in AlertBlockSyntax.parseChildLines #584

Closed jonasfj closed 9 months ago

jonasfj commented 9 months ago

I ran test/crash_test.dart and found 9 markdown files where package:markdown crashes:

Bad state: No element
#0      List.last (dart:core-patch/growable_array.dart:348:5)
#1      AlertBlockSyntax.parseChildLines (package:markdown/src/block_syntaxes/alert_block_syntax.dart:54:35)
#2      AlertBlockSyntax.parse (package:markdown/src/block_syntaxes/alert_block_syntax.dart:85:24)
#3      BlockParser.parseLines (package:markdown/src/block_parser.dart:178:32)
#4      Document.parseLineList (package:markdown/src/document.dart:87:44)
#5      Document.parse (package:markdown/src/document.dart:83:36)
#6      markdownToHtml (package:markdown/src/html_renderer.dart:40:26)

Full log in: https://gist.github.com/jonasfj/9d8dfb702f46e64b78a22f5762ac2f95

This ran a scan of all .md files in the latest version of all packages on pub.dev.


@AlexV525, @devoncarew, could this be related to:

AlexV525 commented 9 months ago

@jonasfj Thanks for the report. Unfortunately, I'm doing other work which occupied most of my time so I cannot respond to this in recent days. I can look into this when I'm available.