-
Notifications
You must be signed in to change notification settings - Fork 1.6k
<xloctime>: time_get::get can still assert 'istreambuf_iterator is not dereferenceable' when the format is longer than the stream #2851
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
This comment was marked as resolved.
This comment was marked as resolved.
fsb4000
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again for your hard work. I left some comments about the code style.
…into stl_gettime_issue # Conflicts: # tests/std/tests/Dev11_0836436_get_time/test.cpp
MattStephanson
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you're interested, this might be a good opportunity to harmonize the loops here in _Getfmt and in get. I believe the latter is closer to what the Standard requires in [locale.time.get.members]/8. _Getfmt has some additional assumptions for performance purposes, but I think the overall logic should be the same, so it might be more clear and maintainable if the two loops are doing comparable tests in the same order.
If you don't want to go that route, though, I still think it would be better to have _First == _Last as a standalone test at the beginning of the loop, for performance reasons. IOW, if (*_Fmtfirst == '%') would become an else if following the _First == _Last test. Otherwise, we could make several calls to do_get even after the stream is eof.
Would you suggest a good comment for this standalone test? |
This isn't a test as in "unit test", so no comment needed, in my opinion. |
MattStephanson
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
|
Looks good to me too. I agree that testing |
strega-nil-ms
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems clearly correct according to the standardese.
|
I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
|
Thanks for fixing this runtime correctness bug, and congratulations on your second microsoft/STL commit! 🎉 😻 🚀 This will ship in VS 2022 17.4 Preview 2. |
…t dereferenceable' when the format is longer than the stream (microsoft#2851)
Resolves #2848