[WIN32SS/NTGDI]

- Reject bits data early in SetBitmapBits when it's clear that they can't fit in the destination bitmap.
Fixes ugly Office 2007 rulers showing garbage.

svn path=/trunk/; revision=66342
This commit is contained in:
Jérôme Gardou 2015-02-17 20:41:51 +00:00
parent d40314e7dd
commit fddcf61917

View file

@ -11,7 +11,8 @@
#define NDEBUG #define NDEBUG
#include <debug.h> #include <debug.h>
void static
int
NTAPI NTAPI
UnsafeSetBitmapBits( UnsafeSetBitmapBits(
PSURFACE psurf, PSURFACE psurf,
@ -32,6 +33,9 @@ UnsafeSetBitmapBits(
lDeltaDst = psurf->SurfObj.lDelta; lDeltaDst = psurf->SurfObj.lDelta;
lDeltaSrc = WIDTH_BYTES_ALIGN16(nWidth, cBitsPixel); lDeltaSrc = WIDTH_BYTES_ALIGN16(nWidth, cBitsPixel);
if (cjBits && (cjBits < (lDeltaSrc * nHeight)))
return 0;
while (nHeight--) while (nHeight--)
{ {
/* Copy one line */ /* Copy one line */
@ -40,6 +44,7 @@ UnsafeSetBitmapBits(
pjDst += lDeltaDst; pjDst += lDeltaDst;
} }
return 1;
} }
HBITMAP HBITMAP
@ -538,9 +543,8 @@ NtGdiSetBitmapBits(
_SEH2_TRY _SEH2_TRY
{ {
ProbeForRead(pUnsafeBits, Bytes, 1); ProbeForRead(pUnsafeBits, Bytes, sizeof(WORD));
UnsafeSetBitmapBits(psurf, Bytes, pUnsafeBits); ret = UnsafeSetBitmapBits(psurf, Bytes, pUnsafeBits);
ret = 1;
} }
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{ {