dbuenzli / cmarkit

CommonMark parser and renderer for OCaml
https://erratique.ch/software/cmarkit
ISC License
46 stars 8 forks source link

Parser crashes on incomplete ordered and unordered lists #18

Closed TyOverby closed 9 months ago

TyOverby commented 9 months ago

Ordered Lists

input.md

1.

(no newline at end of file)

error

Raised at Cmarkit_lib__Cmarkit.Block_struct.accept_cols.loop in file "cmarkit.ml" (inlined), line 1961, characters 9-16
Called from Cmarkit_lib__Cmarkit.Block_struct.accept_cols in file "cmarkit.ml", line 1968, characters 4-50
Called from Cmarkit_lib__Cmarkit.Block_struct.accept_list_marker_and_indent in file "cmarkit.ml" (inlined), line 1990, characters 4-35
Called from Cmarkit_lib__Cmarkit.Block_struct.list_item in file "cmarkit.ml", line 2440, characters 23-73
Called from Cmarkit_lib__Cmarkit.Block_struct.list in file "cmarkit.ml", line 2460, characters 32-53
Called from Cmarkit_lib__Cmarkit.Block_struct.parse.loop in file "cmarkit.ml" (inlined), line 2719, characters 15-28
Called from Cmarkit_lib__Cmarkit.Block_struct.parse in file "cmarkit.ml", line 2723, characters 8-17
Called from Cmarkit_lib__Cmarkit.Doc.of_string in file "cmarkit.ml", line 2974, characters 18-38

Unordered Lists

input.md

-

(no newline at end of file)

error

(Invalid_argument "index out of bounds")
  Raised at Cmarkit_lib__Cmarkit.Block_struct.accept_cols.loop in file "cmarkit.ml" (inlined), line 1961, characters 9-16
Called from Cmarkit_lib__Cmarkit.Block_struct.accept_cols in file "cmarkit.ml", line 1968, characters 4-50
Called from Cmarkit_lib__Cmarkit.Block_struct.accept_list_marker_and_indent in file "cmarkit.ml" (inlined), line 1990, characters 4-35
Called from Cmarkit_lib__Cmarkit.Block_struct.list_item in file "cmarkit.ml", line 2440, characters 23-73
Called from Cmarkit_lib__Cmarkit.Block_struct.list in file "cmarkit.ml", line 2460, characters 32-53
Called from Cmarkit_lib__Cmarkit.Block_struct.parse.loop in file "cmarkit.ml" (inlined), line 2719, characters 15-28
Called from Cmarkit_lib__Cmarkit.Block_struct.parse in file "cmarkit.ml", line 2723, characters 8-17
Called from Cmarkit_lib__Cmarkit.Doc.of_string in file "cmarkit.ml", line 2974, characters 18-38
dbuenzli commented 9 months ago

Thanks!

Incidentally this also fixed a position bug I hadn't seen in the test suite that would have been a bit annoying to track.