[PATCH 1/2] ntdll: Use the correct size when the read spans a page boundary.

Huw Davies huw at codeweavers.com
Tue May 26 04:57:23 CDT 2020


Signed-off-by: Huw Davies <huw at codeweavers.com>
---
 dlls/ntdll/virtual.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
index f678b2387a..005c3ee441 100644
--- a/dlls/ntdll/virtual.c
+++ b/dlls/ntdll/virtual.c
@@ -2628,7 +2628,7 @@ SIZE_T virtual_uninterrupted_read_memory( const void *addr, void *buffer, SIZE_T
 
             while (bytes_read < size && (VIRTUAL_GetUnixProt( get_page_vprot( page )) & PROT_READ))
             {
-                SIZE_T block_size = min( size, page_size - ((UINT_PTR)addr & page_mask) );
+                SIZE_T block_size = min( size - bytes_read, page_size - ((UINT_PTR)addr & page_mask) );
                 memcpy( buffer, addr, block_size );
 
                 addr   = (const void *)((const char *)addr + block_size);
-- 
2.23.0




More information about the wine-devel mailing list