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

Avoid undefined behaviour #1

Merged
merged 1 commit into from
Nov 23, 2021
Merged

Avoid undefined behaviour #1

merged 1 commit into from
Nov 23, 2021

Conversation

dimbleby
Copy link
Contributor

@dimbleby dimbleby commented Nov 22, 2021

memcpy() with a null destination or source is undefined.

I realise that this parser is work in progress, but I couldn't resist pointing the fuzzer at it to see what it had to say. This was the first thing that it found; so I thought I'd send you an MR.

The other that I have discovered is that the following file causes an infinite loop:

```

that's three backticks and - importantly - no final new line character (the file contains just three bytes).

Probably it doesn't make much sense for me to be fuzzing this in its current state so I'll stop now. But I'd encourage you to set it up for yourself: it's not so hard and, as above, it'll find bugs!

memcpy() with a null destination or source is undefined
@MDeiml
Copy link
Collaborator

MDeiml commented Nov 23, 2021

Thank you for your efforts. As you said this is still very much in development and the code is quite a mess atm. Still, fuzzing is something I wanted to setup so this is very helpful. I've never worked with fuzzers before, could you share your setup?

@MDeiml MDeiml merged commit c9d180a into tree-sitter-grammars:main Nov 23, 2021
@dimbleby
Copy link
Contributor Author

I followed the path set out in this comment; though I see that https://github.com/tree-sitter/tree-sitter/blob/master/test/fuzz/README.md is a thing and perhaps better.

MDeiml added a commit that referenced this pull request Nov 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants