gdi32: uninitialized biCompression in GetDIBits(valgrind)
marc.bessieres at mykolab.com
marc.bessieres at mykolab.com
Mon Nov 24 14:18:28 CST 2014
From: Marc Bessières <marc.bessieres at mykolab.com>
fix for https://bugs.winehq.org/show_bug.cgi?id=37159
biCompression field was not initialized with the input bitmap while it
was used in bitmapinfoheader_from_user_bitmapinfo.
So:
- move the code calling bitmapinfoheader_from_user_bitmapinfo after we
got the bitmap from the input handler.
- initialize info->bmiHeader.biCompression
---
dlls/gdi32/dib.c | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/dlls/gdi32/dib.c b/dlls/gdi32/dib.c
index 708a9a8..99b1a0e 100644
--- a/dlls/gdi32/dib.c
+++ b/dlls/gdi32/dib.c
@@ -1212,16 +1212,6 @@ INT WINAPI GetDIBits(
struct bitblt_coords src, dst;
BOOL empty_rect = FALSE;
- /* Since info may be a BITMAPCOREINFO or any of the larger BITMAPINFO structures, we'll use our
- own copy and transfer the colour info back at the end */
- if (!bitmapinfoheader_from_user_bitmapinfo( &dst_info->bmiHeader, &info->bmiHeader )) return 0;
- if (coloruse > DIB_PAL_COLORS) return 0;
- if (bits &&
- (dst_info->bmiHeader.biCompression == BI_JPEG || dst_info->bmiHeader.biCompression == BI_PNG))
- return 0;
- dst_info->bmiHeader.biClrUsed = 0;
- dst_info->bmiHeader.biClrImportant = 0;
-
if (!(dc = get_dc_ptr( hdc )))
{
SetLastError( ERROR_INVALID_PARAMETER );
@@ -1234,6 +1224,17 @@ INT WINAPI GetDIBits(
return 0;
}
+ info->bmiHeader.biCompression = bmp->dib.dsBmih.biCompression;
+ /* Since info may be a BITMAPCOREINFO or any of the larger BITMAPINFO structures, we'll use our
+ own copy and transfer the colour info back at the end */
+ if (!bitmapinfoheader_from_user_bitmapinfo( &dst_info->bmiHeader, &info->bmiHeader )) return 0;
+ if (coloruse > DIB_PAL_COLORS) return 0;
+ if (bits &&
+ (dst_info->bmiHeader.biCompression == BI_JPEG || dst_info->bmiHeader.biCompression == BI_PNG))
+ return 0;
+ dst_info->bmiHeader.biClrUsed = 0;
+ dst_info->bmiHeader.biClrImportant = 0;
+
src.visrect.left = 0;
src.visrect.top = 0;
src.visrect.right = bmp->dib.dsBm.bmWidth;
--
2.1.2
More information about the wine-patches
mailing list