1
0
mirror of synced 2024-11-12 10:10:53 +01:00

fix: Crash when trying to remove chunks larger than the whole file

This commit is contained in:
WerWolv 2023-07-06 21:14:50 +02:00
parent 33d3bea472
commit 2449b08f64

View File

@ -115,6 +115,12 @@ namespace hex::plugin::builtin {
} }
void FileProvider::remove(u64 offset, size_t size) { void FileProvider::remove(u64 offset, size_t size) {
if (offset > this->getActualSize() || size == 0)
return;
if ((offset + size) > this->getActualSize())
size = this->getActualSize() - offset;
auto oldSize = this->getActualSize(); auto oldSize = this->getActualSize();
std::vector<u8> buffer(0x1000); std::vector<u8> buffer(0x1000);