mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-03 05:57:40 -05:00
fix: Out of bounds read with a zero-size file
This commit is contained in:
@@ -64,7 +64,8 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
|
||||
void FileProvider::readRaw(u64 offset, void *buffer, size_t size) {
|
||||
if (offset > (this->getActualSize() - size) || buffer == nullptr || size == 0)
|
||||
auto actualSize = this->getActualSize();
|
||||
if (actualSize == 0 || (offset + size) > actualSize || buffer == nullptr || size == 0)
|
||||
return;
|
||||
|
||||
std::memcpy(buffer, this->m_file.getMapping() + offset, size);
|
||||
|
||||
Reference in New Issue
Block a user