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 UUID length overflow #14

Merged
merged 2 commits into from
Feb 12, 2019

Conversation

maxpolezhaev
Copy link

Decode method of DefaultEncoder (base57) doesn't return an error when given a shortuuid string that internally converts to a number longer than 32 hex digits (UUIDs max length), outstanding digits in the returned UUID are simply truncated. Then if such UUID is encoded back to shortuuid its value is different from the initial shortuuid.

shortuuids which overflow UUIDs max length should be recognized by the library as invalid and a corresponding error should be returned.

I implemented this in my pull request, and added a test for decoding errors.

@lithammer
Copy link
Owner

Looks good. Thanks!

@lithammer lithammer merged commit 3d7d0e9 into lithammer:master Feb 12, 2019
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