From a0772da5cf507b10800d5358554d682f82f48724 Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Wed, 6 May 2020 15:15:56 +0800 Subject: [PATCH] ntdll: Don't try to map the PE file past the size of the backing file. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=42125 Signed-off-by: Dmitry Timoshkov Signed-off-by: Alexandre Julliard --- dlls/ntdll/virtual.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c index 7700385eb7b..399b0de41f9 100644 --- a/dlls/ntdll/virtual.c +++ b/dlls/ntdll/virtual.c @@ -1588,6 +1588,7 @@ static NTSTATUS map_image( HANDLE hmapping, ACCESS_MASK access, int fd, int top_ /* unaligned sections, this happens for native subsystem binaries */ /* in that case Windows simply maps in the whole file */ + total_size = min( total_size, ROUND_SIZE( 0, st.st_size )); if (map_file_into_view( view, fd, 0, total_size, 0, VPROT_COMMITTED | VPROT_READ | VPROT_WRITECOPY, removable ) != STATUS_SUCCESS) goto error; -- 2.11.4.GIT