-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
seq 4e4000003 4e4000003
is causing an infinite loop
#6182
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
Comments
seq 4e4000003 4e4000003
is causing an infinite loop
Identified with #6183 |
It appears that this might be an issue with the BigDecimal crate. |
yes, it is ;) |
But it seems like uutils/coreutils does the string conversion. For some reason, we're turning |
yeah, maybe we are doing something wrong but bigdecimal might want to reject it directly |
@maxer137 did you have a chance to look into this a bit more? |
I tried running this command
This is the output. So it isn't specifically an infinite loop but takes much time to run, still a deviation from gnu though. |
Upon further investigation I found that seq supports floating point only upto f128(128 bit floating point number). For example, |
Indeed. Using BigDecimal we are able to go up to much larger values than originally in GNU seq. I have removed the zero padding from This seems to still allow very large numbers such as We could decide to either parse the value into an f128 value and then either reject or accept depending on if it is a valid value, or we accept that the uutils implementation can go above the ranges of GNU’s implementation. |
Add a positive (accepts `f128`) and a negative (rejects non `f128`) test.
I'm interested in helping with this, as a way to learn the codebase. What I've noticed in my debugging so far is that the big slowdown happens when the code increments 4e4000003 and checks whether it should do another loop iteration. The internal BigDecimal representation of 4e4000003 has one digit, while the representation of 4e4000003 + 1 has 400,004 digits. I can think of a few options:
If the maintainers have a preference among those (or some other approach), I'd be happy to work on a PR. |
Uh oh!
There was an error while loading. Please reload this page.
Looking at seq oss fuzz coverage, I noticed that it wasn't producing much.
Writing a fuzz on seq parse number, i noticed that:
cargo run seq 4e4000003 4e4000003
is running forever
while GNU is doing:
The text was updated successfully, but these errors were encountered: