aboutsummaryrefslogtreecommitdiff
path: root/zencore/iobuffer.cpp
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2021-08-23 19:47:01 +0200
committerStefan Boberg <[email protected]>2021-08-23 19:47:01 +0200
commit4c2624b25b7ab4916257cf5e97baa1d47e9dba4d (patch)
tree77e80c917275d371e0ebcf0a2da3e5e49cdee13d /zencore/iobuffer.cpp
parentFormat fix. (diff)
downloadzen-4c2624b25b7ab4916257cf5e97baa1d47e9dba4d.tar.xz
zen-4c2624b25b7ab4916257cf5e97baa1d47e9dba4d.zip
Fixed logic in IoBufferExtendedCore::Materialize() - would previously map the wrong amount of memory for misaligned chunks
Diffstat (limited to 'zencore/iobuffer.cpp')
-rw-r--r--zencore/iobuffer.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/zencore/iobuffer.cpp b/zencore/iobuffer.cpp
index 732d4d603..b8dd62840 100644
--- a/zencore/iobuffer.cpp
+++ b/zencore/iobuffer.cpp
@@ -199,13 +199,12 @@ IoBufferExtendedCore::Materialize() const
const uint64_t MapOffset = m_FileOffset & ~0xffffull;
const uint64_t MappedOffsetDisplacement = m_FileOffset - MapOffset;
- const uint64_t MapSize = (MappedOffsetDisplacement + m_DataBytes + 0xffffu) & ~0xffffull;
void* MappedBase = MapViewOfFile(m_MmapHandle,
/* dwDesiredAccess */ FILE_MAP_READ,
/* FileOffsetHigh */ uint32_t(MapOffset >> 32),
/* FileOffsetLow */ uint32_t(MapOffset & 0xffFFffFFu),
- /* dwNumberOfBytesToMap */ m_DataBytes);
+ /* dwNumberOfBytesToMap */ m_DataBytes + MappedOffsetDisplacement);
if (MappedBase == nullptr)
{