-
Notifications
You must be signed in to change notification settings - Fork 4
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
Parsing numbers starting with 0 is not supported #3
Comments
Actually, it fails with SIMD enabled as well. So turning SIMD on/off doesn't make any difference. |
I am also getting a similar error when trying to parse The standard library implementation also handles this one correctly. |
Zeroes at the beginning of the input are not supported by the design, and I am not sure if it's needed, because it will work slower. |
I see, thanks for clarification. Parsing numbers with leading zeroes is something people also need to do, and I think this library could do it faster than |
Hm, it might be not that slow as I thought. Will think about it, thanks |
It works, but with length not more then type's numbers max length 2288368 (starting with 16) |
FWIW the standard library parser supports even longer sequences of leading zeroes, so that 000000000000000001 does parse correctly into a It's up to you whether you choose to support this use case. |
I just don't see any use cases. If anybody needs it, write it here, with an explanation of the use case, would be interesting to know. |
Done in a separate function |
Add the following test to the codebase:
Run it with SIMD disabled (with the
.cargo/config.toml
file deleted) and you'll see that it fails. Meanwhile the standard library parses this number correctly.This bug was discovered using
cargo-fuzz
. You can find a guide to it here and the fuzzing setup I used here. I will contribute the fuzzing setup to your repository eventually.The text was updated successfully, but these errors were encountered: