Module: wine Branch: refs/heads/master Commit: 4f5cbfb43d2f4a5f5c9883c28a28c9095c9ac448 URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=4f5cbfb43d2f4a5f5c9883c2...
Author: Ulrich Czekalla ulrich@codeweavers.com Date: Tue Jan 3 12:09:03 2006 +0100
gdi32: Disallow creation of compressed DIB sections.
---
dlls/gdi/dib.c | 13 +++++++------ 1 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/dlls/gdi/dib.c b/dlls/gdi/dib.c index 26b8a1a..b408118 100644 --- a/dlls/gdi/dib.c +++ b/dlls/gdi/dib.c @@ -1148,6 +1148,12 @@ HBITMAP DIB_CreateDIBSection(HDC hdc, co &planes, &bpp, &compression, &sizeImage )) == -1)) return 0;
+ if (compression != BI_RGB && compression != BI_BITFIELDS) + { + TRACE("can't create a compressed (%lu) dibsection\n", compression); + return 0; + } + if (!(dib = HeapAlloc( GetProcessHeap(), 0, sizeof(*dib) ))) return 0;
TRACE("format (%ld,%ld), planes %d, bpp %d, size %ld, %s\n", @@ -1186,12 +1192,7 @@ HBITMAP DIB_CreateDIBSection(HDC hdc, co if( bpp <= 8 ) dib->dsBmih.biClrUsed = 1 << bpp;
- /* only use sizeImage if it's valid and we're dealing with a compressed bitmap */ - if (sizeImage && (compression == BI_RLE4 || compression == BI_RLE8)) - dib->dsBmih.biSizeImage = sizeImage; - else - dib->dsBmih.biSizeImage = dib->dsBm.bmWidthBytes * dib->dsBm.bmHeight; - + dib->dsBmih.biSizeImage = dib->dsBm.bmWidthBytes * dib->dsBm.bmHeight;
/* set dsBitfields values */ if (usage == DIB_PAL_COLORS || bpp <= 8)