You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have numerical overflow on two cases: we parsed more digits than we theoretically could, or we parsed the same number as the maximum, but the number wrapped. Since the number wrapping will always produce a smaller value than the minimum value for that number of digits, this is a simple comparison.
In the test case above, 357 would wrap to 101, which is not smaller than the minimum value (100) for the maximum number of digits (3 digits for u8).
Prerequisites
Here are a few things you should provide to help me understand the issue:
Description
The current overflow checking logic for integers cannot check for all numeric overflow, as shown in this failing test case:
Specifically, the problem seems to be this claim in the algorithm description:
In the test case above,
357
would wrap to101
, which is not smaller than the minimum value (100
) for the maximum number of digits (3 digits foru8
).Prerequisites
Here are a few things you should provide to help me understand the issue:
rustc 1.68.0-nightly (ad8ae0504 2022-12-29)
Test case
Using lexical-parse-integer 0.8.6 directly:
Additional context
The incorrect logic seems to be implemented here:
rust-lexical/lexical-parse-integer/src/shared.rs
Lines 159 to 176 in 09c686b
The text was updated successfully, but these errors were encountered: