Dmitry Timoshkov : ntdll: Don't try to map the PE file past the size of the backing file.

Alexandre Julliard julliard at winehq.org
Fri Aug 7 10:42:29 CDT 2020


Module: wine
Branch: stable
Commit: 70ce97ea6d4987da2b7b07a86dfcf9f187e3c383
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=70ce97ea6d4987da2b7b07a86dfcf9f187e3c383

Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date:   Wed May  6 15:15:56 2020 +0800

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 <dmitry at baikal.ru>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit a0772da5cf507b10800d5358554d682f82f48724)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>

---

 dlls/ntdll/virtual.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
index 5890344f7a..9d8249ea4f 100644
--- a/dlls/ntdll/virtual.c
+++ b/dlls/ntdll/virtual.c
@@ -1592,6 +1592,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;
 




More information about the wine-cvs mailing list