[io] Add buffer bound checks in TFile::Recover#22190
Conversation
668624f to
33f969c
Compare
Test Results 22 files 22 suites 3d 11h 34m 26s ⏱️ For more details on these failures, see this check. Results for commit 986cb8f. ♻️ This comment has been updated with latest results. |
| fRemainingBufSize -= additionalBytesNeeded; | ||
| return true; | ||
| } | ||
| } RequireAdditionalBufCapacity{this, bufsize}; |
There was a problem hiding this comment.
The name invoke the converse of the usage. It sounds like we are reserving/add capacity to be written to where as the actual operation is closer to Consuming some of the existing capacity (with no possibility to add to it (i.e. no additional)). What about something like AdvanceCursor or ConsumeCapacity or ReserveSpaceInOutputBuffer ?
There was a problem hiding this comment.
I think the verb is appropriate, as we require that many additional bytes in order to proceed: if our requirement isn't met, we bail out and fail.
Could maybe be called Ensure instead of Require, as that's a sort-of-convention we do use from time to time
This prevents potential oob stack reads in case of corrupted TFiles
- Declare variables when they're used - Spare a needless dynamic allocation - Use memcpy instead of frombuf in a loop
986cb8f to
5aa5f11
Compare
TODO
This PR fixes #22169