mirror of https://github.com/aria2/aria2
Compare filesize directly to the numeric max of size_t
parent
43aea5c940
commit
ef0a2e601f
|
@ -373,8 +373,7 @@ void AbstractDiskWriter::ensureMmapWrite(size_t len, int64_t offset)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t filesize_lo = filesize & 0xffffffffu;
|
if (static_cast<uint64_t>(std::numeric_limits<size_t>::max()) < static_cast<uint64_t>(filesize)) {
|
||||||
if (sizeof(off_t) > sizeof(size_t) && (filesize_lo) > 0) {
|
|
||||||
// filesize could overflow in 32bit OS with 64bit off_t type
|
// filesize could overflow in 32bit OS with 64bit off_t type
|
||||||
// the filesize will be truncated if provided as a 32bit size_t
|
// the filesize will be truncated if provided as a 32bit size_t
|
||||||
enableMmap_ = false;
|
enableMmap_ = false;
|
||||||
|
|
Loading…
Reference in New Issue