mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-29 06:13:20 +00:00
Correct a cast when measuring history file size
If the history file is larger than 4GB on a 32 bit system, fish will refuse to read it. However the check was incorrect because it cast the file size to size_t, which may be 32 bit. Switch to using uint64.
This commit is contained in:
parent
a91e1a8cab
commit
002c2b6170
1 changed files with 1 additions and 1 deletions
|
@ -157,7 +157,7 @@ bool history_file_contents_t::infer_file_type() {
|
||||||
std::unique_ptr<history_file_contents_t> history_file_contents_t::create(int fd) {
|
std::unique_ptr<history_file_contents_t> history_file_contents_t::create(int fd) {
|
||||||
// Check that the file is seekable, and its size.
|
// Check that the file is seekable, and its size.
|
||||||
off_t len = lseek(fd, 0, SEEK_END);
|
off_t len = lseek(fd, 0, SEEK_END);
|
||||||
if (len <= 0 || static_cast<unsigned long>(len) >= SIZE_MAX) return nullptr;
|
if (len <= 0 || static_cast<uint64_t>(len) >= static_cast<uint64_t>(SIZE_MAX)) return nullptr;
|
||||||
|
|
||||||
bool mmap_file_directly = should_mmap();
|
bool mmap_file_directly = should_mmap();
|
||||||
std::unique_ptr<mmap_region_t> region =
|
std::unique_ptr<mmap_region_t> region =
|
||||||
|
|
Loading…
Reference in a new issue