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: possible rollover of nanoseconds in clock.h #1990

Merged
merged 1 commit into from Feb 1, 2023

Conversation

paf31
Copy link
Contributor

@paf31 paf31 commented Dec 14, 2022

Setting a timeout on a parser can result in a non-deterministic behavior, where parsers time out when they should not. An incorrect timeout is more likely for timeout intervals closer to (but less than) 1s. We noticed that the distribution of these incorrect timeouts didn't seem to be correlated with the complexity of the inputs.

The cause seems to be this possible rollover of the nanoseconds component of timespec in clock.h. Patching this fixes the timeout issue.

I'm not sure how I would go about adding tests for this, but if you think they are necessary and can provide some pointers, I'd be happy to include them.

Thanks!

@maxbrunsfeld maxbrunsfeld merged commit e021d6e into tree-sitter:master Feb 1, 2023
@maxbrunsfeld
Copy link
Contributor

Sorry for the delay, and thanks for the fix!

@paf31 paf31 deleted the fix/nanos-rollover branch February 1, 2023 21:16
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.

None yet

2 participants