-
Notifications
You must be signed in to change notification settings - Fork 546
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
datetime_from_str is too lenient, doesn't roundtrip #548
Comments
It looks like the Line 325 in 3467172
|
Looking with git blame the trim_left has been with us for 6 years so I guess it aims to give a more lenient than strict parsing, same goes with accepting Just tested with against my local glibc (2.31-0ubuntu9.2) how does For my case, I will probably match it to a regex before passing it over to I still think the docs would probably need to changed at https://docs.rs/chrono/0.4.19/chrono/format/strftime/index.html:
Apologies if these are already collected somewhere. |
I was looking at the failures if I were to comment the Line 2417 in 3467172
Sadly it does not make for a good property to fuzz given the negative |
For another crate
cargo-fuzz
found me the input"4\t3\t\u{c}\t\t3\t\u{c}\t5\t3\t60Z"
which is parsed successfully withUtc.datetime_from_str(s, "%Y%m%d%H%M%S%.3fZ")
. Minimal test case for version0.4.19
:There are certainly more of these with fuzzing target:
As far as I understand by looking at the documentation,
"4\t3"
should not get through"%Y%m"
as"%Y"
should be zero padded 4 positive digits. Overall I think the format string in question should only allow input which is formatted exactly same, though I read that the%.xf
might be lenient for the number of zeroes. I'll try to see if I can offer any help with this. Could be that what I am after is out of scope of chrono.The text was updated successfully, but these errors were encountered: