LWG-3464 istream::gcount() can overflow#1483
LWG-3464 istream::gcount() can overflow#1483StephanTLavavej merged 3 commits intomicrosoft:masterfrom
Conversation
barcharcraz
left a comment
There was a problem hiding this comment.
I wouldn't mind tests for this, but I won't demand them.
|
Thanks for mentioning testing - while thinking about whether it would be practical to test this, I realized that I was confused by reading LWG-3464, which said:
This might not apply to our implementation. We always use Line 49 in c2ab522 Line 664 in c2ab522 Lines 602 to 604 in c2ab522 There's no practical way to exceed 263 - 1, and thus no practical way to test this. However, we are affected by #388 - I'm not sure if that's relevant here. I would guess not, since this is directly incrementing an integer, but I'm not certain. So, I wonder whether we need to make any changes here at all. That said, I believe that the PR clearly doesn't harm correctness, and I believe that it won't harm performance either (the function can be inlined, and the branch is trivially predictable). |
|
Thanks for implementing this LWG issue and making the Status Chart happier (when it's updated next week)! 😸 |
LWG-3464
istream::gcount()can overflow, so in case, if_Chcountis negative, returnstd::numeric_limits<streamsize>::max()Fixes #1480