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

fix: try to avoid segfaults in scanner.cc #1

Merged
merged 1 commit into from
May 5, 2022

Conversation

theHamsta
Copy link

I think the main change is checking for lexer->lookahead before doing
lexer->get_column(lexer) since it was segfaulting in exactly that
function. Rest is just clang-format and call deserialize(nullptr, 0) in the constructor.

At least it's now not segfaulting anymore. I just checked on the fuzzer-side, not whether it is still fully functional. You would have to do that @zealot128 @RianFuro

I think the main change is checking for lexer->lookahead before doing
lexer->get_column(lexer) since it was segfaulting in exactly that
function.
}

if (lexer->get_column(lexer) == 0) {
if (lexer->lookahead && lexer->get_column(lexer) == 0) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the python scanner had a while(lexer->lookahead) around everything

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting... removing the lexer->lookahead part like that in your PR makes a lot of tests fail.
Putting it back in leads to segfault, so it's clear, that's the culprit.
Just opening a random vue with pug shows that the highlighting works at least, but the tests somehow show differences which I have to investigate.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed more in this PR that just the lookahead. Maybe the reason why tests are failing are in other parts of this PR. I only tried to make the parser not SEGFAULT. I have no experience with pug or how this should be parsed

@theHamsta
Copy link
Author

Fixes #2360

@zealot128 zealot128 merged commit 23eba6f into zealot128:master May 5, 2022
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