Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

date: fix panic with leading zeros #1

Merged
merged 1 commit into from
Jun 29, 2023
Merged

Conversation

aschey
Copy link
Contributor

@aschey aschey commented Jun 29, 2023

I was trying out Festival today and it kept crashing when trying to import my files. On inspection, it was because one of my files had a date tag of 0305. Calling Date::from_str_silent("0305") was panicking when calling Buffer::from_4_unchecked because the u16 value only had 3 bytes instead of 4.

This PR adds an additional check to make sure the parsed u16 value is at least 1000 to prevent leading zeros from causing this issue.

@hinto-janai
Copy link
Owner

Wow, that's embarrassing. Thanks for the really clean fix.

@hinto-janai hinto-janai merged commit 976d5b3 into hinto-janai:main Jun 29, 2023
@aschey
Copy link
Contributor Author

aschey commented Jun 29, 2023

Haha, it happens! Thanks!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants