Skip to content
This repository has been archived by the owner on Feb 20, 2021. It is now read-only.

Commit

Permalink
[PR] Fixed pointer overflow crash when using bgsave under rare circum…
Browse files Browse the repository at this point in the history
…stances.

(cherry picked from commit 0707007)
  • Loading branch information
Harachie authored and enricogior committed Jun 21, 2016
1 parent 164f486 commit 3e5cd0f
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/Win32_Interop/Win32_Common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,9 @@ void EnsureMemoryIsMapped(const void *buffer, size_t size) {
if ((size_t) (pEnd - pStart) > Globals::pageSize) {
size_t offset = 0;
while (offset < size) {
if (size < offset) {
offset += Globals::pageSize;
if (offset > size) {
offset = size;
} else {
offset += Globals::pageSize;
}
c = *((char*) (p + offset));
}
Expand All @@ -62,4 +61,4 @@ bool IsWindowsVersionAtLeast(WORD wMajorVersion, WORD wMinorVersion, WORD wServi
osvi.wServicePackMajor = wServicePackMajor;

return VerifyVersionInfoW(&osvi, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR, dwlConditionMask) != FALSE;
}
}

0 comments on commit 3e5cd0f

Please sign in to comment.