[PATCH v3] gdi32: Avoid exceeding the actual bitmap height.

Huw Davies huw at codeweavers.com
Thu Nov 12 04:38:15 CST 2020


From: Haoyang Chen <chenhaoyang at uniontech.com>

The bottom-up case is handled earlier on.  For the top-down
case, 'lines' is left untouched.

Signed-off-by: Haoyang Chen <chenhaoyang at uniontech.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
---
 dlls/gdi32/dib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dlls/gdi32/dib.c b/dlls/gdi32/dib.c
index 10a7a957973..790ecf06501 100644
--- a/dlls/gdi32/dib.c
+++ b/dlls/gdi32/dib.c
@@ -824,7 +824,7 @@ INT CDECL nulldrv_SetDIBitsToDevice( PHYSDEV dev, INT x_dst, INT y_dst, DWORD cx
             }
             else if (src.y >= lines) return lines;
         }
-        src_info->bmiHeader.biHeight = top_down ? -lines : lines;
+        src_info->bmiHeader.biHeight = top_down ? -min( lines, height ) : lines;
         src_info->bmiHeader.biSizeImage = get_dib_image_size( src_info );
     }
 
-- 
2.23.0




More information about the wine-devel mailing list