-
Notifications
You must be signed in to change notification settings - Fork 1
Add tests for dynamic width specifiers exceeding u16::MAX
#172
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
Conversation
Rust PR rust-lang/rust#136932 (part of rust-lang/rust#99012) limited format string width and precision to 16 bits, causing panics when dynamic padding exceeds `u16::MAX`. These tests validate handling excessively large widths discovered via fuzzing in artichoke/strftime-ruby. They ensure correct, panic-free behavior consistent with CRuby's `Time#strftime`. Additionally add tests for width specifiers which exceed `INT_MAX` to ensure they return the formatting string verbatim, which were among the cases discussed in the upstream PR. See: - Upstream report: rust-lang/rust#136932 (comment) - Proposed fix: rust-lang/rust#136932 (comment)
the code coverage job is panicking because it uses nightly which has the new, panicking |
Since the root cause was identified, the additional tests are more exhaustive and clearer to read
Co-authored-by: Ryan Lopopolo <[email protected]>
There are 2 cases to solve when we have a width between
I will try to make a PR implementing this. |
Does this help? m-ou-se@width (Just posted that on rust-lang/rust#136932 (comment)) |
Yes, this is a good base. |
Published #175 based on this commit. |
thanks for the support @m-ou-se! and thanks so much for driving the perf improvements on the format machinery, the tracking issue is super chunky. |
549a61e
to
5330aec
Compare
There is still a compilation failure when running |
`f64::abs` only recently became available in `no_std` crates: - rust-lang/rust#131304
fixed in 0be636c by bumping MSRV |
code coverage job is failing because some of the more detailed |
Rust PR rust-lang/rust#136932 (part of rust-lang/rust#99012) limited format string width and precision to 16 bits, causing panics when dynamic padding exceeds
u16::MAX
.These tests validate handling excessively large widths discovered via fuzzing in artichoke/strftime-ruby. They ensure correct, panic-free behavior consistent with CRuby's
Time#strftime
.Additionally add tests for width specifiers which exceed
INT_MAX
to ensure they return the formatting string verbatim, which were among the cases discussed in the upstream PR.This does not yet fix the panics when using padding widths
> u16::MAX
. Would love ideas on the best approach to take for that.See:
width
andprecision
to 16 bits rust-lang/rust#136932 (comment)width
andprecision
to 16 bits rust-lang/rust#136932 (comment)