commonmark / commonmark/cmark

`parse_list_marker` Does Not Correctly Check for CRLF.

Open
#550 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
2k
Forks
691
Avg merge
1d 16h
Merged PRs (30d)
1

Description

I'm just reading through the code, and I may be wrong but...

      /* blocks.c > parse_list_marker */

      // require non-blank content after list marker:
      while (S_is_space_or_tab(peek_at(input, i))) {
        i++;
      }
      if (peek_at(input, i) == '\n') {
        return 0;
      }

Seeing as the rest of the parser tries to be compatible with CRLF, I would expect S_is_line_end_char to be used instead of just comparing to a newline char. Am I missing why this is not necessary?

Edit: In the following branch for numbered markers, there is the same logic but S_is_line_end_char is used instead, so I'm pretty sure now that this is an oversight.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in blocks.c at parse_list_marker and compare the blank-content check with the numbered-marker branch that uses S_is_line_end_char. Confirm that list markers followed by CRLF are handled consistently, then run the parser tests and verify the existing behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
compilers
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.