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

Panic due to attempt to multiply with overflow #1

Open
nitroxis opened this issue Sep 18, 2023 · 0 comments · May be fixed by #2
Open

Panic due to attempt to multiply with overflow #1

nitroxis opened this issue Sep 18, 2023 · 0 comments · May be fixed by #2

Comments

@nitroxis
Copy link

Hi,

when comparing strings using natural_lexical_cmp, the code can cause a attempt to multiply with overflow panic when the strings contain a number long enough to overflow a u64.

It might be best to just fall back to simple character comparison if a number exceeds a certain length.

z33ky added a commit to z33ky/lexical-sort that referenced this issue Jul 25, 2024
The previous version tried to convert numeric strings to u64 to compare
the values numerically.
This results in a panic if the number exceeds the bounds of u64.
To fix this, numbers are now compared digit-by-digit instead.

Fixes surrealdb/lexicmp#1.
@z33ky z33ky linked a pull request Jul 25, 2024 that will close this issue
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 a pull request may close this issue.

1 participant