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 lexer_read_on_line returning empty tokens at EOF #25

Merged
merged 1 commit into from
Jan 17, 2020
Merged

Fix lexer_read_on_line returning empty tokens at EOF #25

merged 1 commit into from
Jan 17, 2020

Conversation

ElementW
Copy link
Contributor

@ElementW ElementW commented Apr 19, 2019

At EOF, lexer_read() returns 0 and an empty token.
While this is supposedly taken care of by the if statement it is called in, the statement falls through and reaches the following if (!tok.line_crossed) which may evaluate to true (UB due to line_crossed being uninitialized) and consequently return empty tokens indefinitely.

This PR/commit fixes that by returning early.

Most likely an oversight really.

At EOF, lexer_read() returns 0 and an empty token.
While this is supposedly taken care of by the if statement it is called
in, the statement falls through and reaches the following
    if (!tok.line_crossed)
which may evaluate to true (UB due to line_crossed being undefined)
and consequently return empty tokens indefinitely.
@vurtun vurtun merged commit 1569895 into vurtun:master Jan 17, 2020
@vurtun
Copy link
Owner

vurtun commented Jan 17, 2020

Thanks for the PR.

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