fix: Segfault when hashing regions spanning multiple MiBs (#1804)
### Problem description Attempting to do an MD5 hash of a large region (e.g. 2 MiB, ``u8 data[0x200000]``) crashes with a segfault. ### Implementation description In ``hex::plugin::hashes::hashProviderRegionWithHashLib()``, ``hashFunction->TransformBytes()`` is called with an offset of 0, because it iterates over ``data`` and not the entire region.
This commit is contained in:
parent
75e5dbaaa4
commit
e50b6733c4
@ -27,7 +27,7 @@ namespace hex::plugin::hashes {
|
||||
u64 readSize = std::min<u64>(1_MiB, (region.getEndAddress() - address) + 1);
|
||||
|
||||
auto data = reader.read(address, readSize);
|
||||
hashFunction->TransformBytes({ data.begin(), data.end() }, address - region.getStartAddress(), data.size());
|
||||
hashFunction->TransformBytes({ data.begin(), data.end() }, 0, data.size());
|
||||
}
|
||||
|
||||
auto result = hashFunction->TransformFinal();
|
||||
|
Loading…
Reference in New Issue
Block a user