This shouldn’t happen, but if it does, it’s good to have a fallback, lest the loop be stuck until an underflow happens.
It’s not as if it won’t be obvious anymore if a bug happens due to a bad input, but the impact should be lessened.
MFC
Differential D31667
[fgetstr] Handle case if len is negative gfunni234_gmail.com on Aug 24 2021, 6:05 PM. Authored by Tags None Referenced Files
Subscribers
Details
Diff Detail
Event TimelineComment Actions This is now harder to read. If the input size is between INT_MIN (exclusive) and 0 (inclusive) you still overflow buf. If the input is exactly INT_MIN you still have signed integer overflow. This therefore adds nothing of value. |