Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[base] Fix base::CallFtruncate and base::File::SetLength
Use ftruncate64 instead of ftruncate on POSIX systems supporting it. This fixes an unchecked narrowing integer conversion from 64-bit length to 32-bit off_t on systems where the type off_t has only 32 bits. On those systems, trying to create a big file (4+GB) by using File::SetLength resulted in a file of the wrong length due to the integer overflow. BUG=chromium:1236860 TEST=base_unittests --gtest_filter="FileTest.Length" Change-Id: I3e0c4700a03ab0b556bc38e6a93d5188eb5debbc Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3070952 Commit-Queue: François Degros <[email protected]> Auto-Submit: François Degros <[email protected]> Reviewed-by: Daniel Cheng <[email protected]> Cr-Commit-Position: refs/heads/main@{#916237}
- Loading branch information