https://git.reactos.org/?p=reactos.git;a=commitdiff;h=50c9dab6c97837ef014669f5cce9fd3186e1a699

commit 50c9dab6c97837ef014669f5cce9fd3186e1a699
Author:     Timo Kreuzer <[email protected]>
AuthorDate: Sun May 23 14:02:09 2021 +0200
Commit:     Timo Kreuzer <[email protected]>
CommitDate: Thu May 27 15:53:24 2021 +0200

    [WIN32K] Fix wrong calculation in DIB_32BPP_BitBltSrcCopy
    
    Using an unsigned integer will cause the calculations to be unsigned, which 
on x64 leads to wrong results, when adding it to a pointer.
---
 win32ss/gdi/dib/dib32bpp.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/win32ss/gdi/dib/dib32bpp.c b/win32ss/gdi/dib/dib32bpp.c
index 1b2d920e96e..f8e58829a73 100644
--- a/win32ss/gdi/dib/dib32bpp.c
+++ b/win32ss/gdi/dib/dib32bpp.c
@@ -58,7 +58,8 @@ DIB_32BPP_BitBltSrcCopy(PBLTINFO BltInfo)
   PBYTE    SourceBitsT, SourceBitsB, DestBitsT, DestBitsB;
   PBYTE    SourceBits_4BPP, SourceLine_4BPP;
   PDWORD   Source32, Dest32;
-  DWORD    Index, DestWidth, DestHeight;
+  DWORD    Index;
+  LONG     DestWidth, DestHeight;
   BOOLEAN  bTopToBottom, bLeftToRight;
   BOOLEAN  blDeltaSrcNeg, blDeltaDestNeg;
   BOOLEAN  blDeltaAdjustDone = FALSE;
@@ -365,10 +366,9 @@ DIB_32BPP_BitBltSrcCopy(PBLTINFO BltInfo)
       {
         /* SourceBits points to bottom-left pixel for lDelta < 0 and top-left 
for lDelta > 0 */
         SourceBits = (PBYTE)BltInfo->SourceSurface->pvScan0
-          + ((BltInfo->SourcePoint.y
-          + DestHeight - 1) * BltInfo->SourceSurface->lDelta)
+          + ((BltInfo->SourcePoint.y + DestHeight - 1) * 
BltInfo->SourceSurface->lDelta)
           + 4 * BltInfo->SourcePoint.x;
-        /* SourceBits points to bottom-left pixel for lDelta < 0 and top-left 
for lDelta > 0 */
+        /* DestBits points to bottom-left pixel for lDelta < 0 and top-left 
for lDelta > 0 */
         DestBits = (PBYTE)BltInfo->DestSurface->pvScan0
           + ((BltInfo->DestRect.bottom - 1) * BltInfo->DestSurface->lDelta)
           + 4 * BltInfo->DestRect.left;

Reply via email to