https://git.reactos.org/?p=reactos.git;a=commitdiff;h=857dd4ae36a55f8dcf122…
commit 857dd4ae36a55f8dcf122d904ee6993199909d8a
Author: Jérôme Gardou <jerome.gardou(a)reactos.org>
AuthorDate: Mon Dec 7 10:22:28 2020 +0100
Commit: Jérôme Gardou <jerome.gardou(a)reactos.org>
CommitDate: Tue Feb 2 10:17:28 2021 +0100
[NTOS:MM] Properly handle the 1-offset of paging files
---
ntoskrnl/mm/pagefile.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/ntoskrnl/mm/pagefile.c b/ntoskrnl/mm/pagefile.c
index b7d8c83e54e..37870520998 100644
--- a/ntoskrnl/mm/pagefile.c
+++ b/ntoskrnl/mm/pagefile.c
@@ -189,7 +189,7 @@ NTSTATUS
NTAPI
MmReadFromSwapPage(SWAPENTRY SwapEntry, PFN_NUMBER Page)
{
- return MiReadPageFile(Page, FILE_FROM_ENTRY(SwapEntry), OFFSET_FROM_ENTRY(SwapEntry)
- 1);
+ return MiReadPageFile(Page, FILE_FROM_ENTRY(SwapEntry),
OFFSET_FROM_ENTRY(SwapEntry));
}
NTSTATUS
@@ -215,6 +215,9 @@ MiReadPageFile(
return(STATUS_UNSUCCESSFUL);
}
+ /* Normalize offset. */
+ PageFileOffset--;
+
ASSERT(PageFileIndex < MAX_PAGING_FILES);
PagingFile = MmPagingFile[PageFileIndex];