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

Make varint decoding infallible #2853

Merged
merged 2 commits into from
Dec 12, 2023
Merged

Make varint decoding infallible #2853

merged 2 commits into from
Dec 12, 2023

Conversation

casey
Copy link
Collaborator

@casey casey commented Dec 11, 2023

This removes two error paths:

  • Truncated varints, i.e., the last byte has the continuation bit set
  • Varints over the maximum

I think removing these error paths makes parsing slightly easier to implement and more robust.

@casey casey requested a review from raphjaph December 11, 2023 23:37
Copy link
Collaborator

@raphjaph raphjaph left a comment

Choose a reason for hiding this comment

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

These subtleties should be documented somewhere. Probably best right in the code with /// comments

@casey casey merged commit fb569a4 into ordinals:master Dec 12, 2023
6 checks passed
@casey casey deleted the varints branch December 12, 2023 02:35
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