Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect parsing of code block inside list #561

Closed
5225225 opened this issue Jan 10, 2022 · 13 comments · Fixed by #563
Closed

Incorrect parsing of code block inside list #561

5225225 opened this issue Jan 10, 2022 · 13 comments · Fixed by #563
Labels

Comments

@5225225
Copy link
Contributor

5225225 commented Jan 10, 2022

#[test]
fn test_bad_slice_c() {
    parse("+ `\nx\n**\n  *\n  `")
}

Panics with

thread 'test_bad_slice_c' panicked at 'begin <= end (15 <= 14) when slicing `+ `
x
**
  *
  ``', src/parse.rs:802:35

This is deep in the nest of parsing internals, and I have no clue how the parser works here. So uhh.... good luck!

I tried to minimise the test case by removing single characters, and couldn't make it any smaller than this.

@marcusklaas
Copy link
Collaborator

marcusklaas commented Jan 10, 2022

What a beauty! Not only have you found another bug, but you have also challenged my, apparently incorrect, belief that fuzzers either find something in the first minute or nothing at all :-)

I'll have a crack at this.

Thanks again for reporting an interesting catch!

@marcusklaas
Copy link
Collaborator

So uhh.... good luck!

:D

@marcusklaas
Copy link
Collaborator

Keeping this open to remind us to not only not panic, but also render it correctly!

@marcusklaas marcusklaas reopened this Jan 10, 2022
@5225225
Copy link
Contributor Author

5225225 commented Jan 10, 2022

Cool! Thanks for the fast fix.

I'll leave a fuzzer running overnight and see what happens.

My previous fuzzing was actually running on ASCII only with a limited character set purely to not find too many issues, but it seems like all the easy to find issues are indeed done, and we're now finding the Spicy:tm: issues, so I'll run it with "any valid &str".

@marcusklaas
Copy link
Collaborator

Haha, I'm super eager to see what 🌶️ issues you will find!

@marcusklaas
Copy link
Collaborator

Oh no, I just tried fuzzing with

let parser = Parser::new_ext(data, Options::all());

and it found panics immediately 🙈

Still lots of work to do!

@marcusklaas
Copy link
Collaborator

Both "\n # #\r\u{1c} " and "<\n #\t%\r\u{0}" produce panics...

@marcusklaas
Copy link
Collaborator

Looking at this tomorrow 😅

@5225225
Copy link
Contributor Author

5225225 commented Jan 10, 2022

Ah, right! Yes, I've been fuzzing with default options...

I'll amend my PR (#562) to fuzz both the input and the options.

@Martin1887
Copy link
Collaborator

Is this still an issue, @5225225? If it is, I will try to fix it.

Thanks.

@5225225
Copy link
Contributor Author

5225225 commented May 7, 2023

The panic has been fixed, but the behavior is incorrect (See the discussion in the PR #563). I'll change the issue title to reflect that.

@5225225 5225225 changed the title Panic when parsing inline code block Incorrect parsing of code block inside list May 7, 2023
@Martin1887
Copy link
Collaborator

OK, I see this less relevant then, I will try to solve it in the future but it is less urgent now.

@Martin1887
Copy link
Collaborator

Martin1887 commented Nov 4, 2023

This has been fixed, a space between the first two asterisks and the last one is rendered inside the code block now. Surely fixed by one of the latest pull requests about handling emphasis.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants