Author: dchapyshev
Date: Thu Mar 5 15:22:35 2009
New Revision: 39882
URL:
http://svn.reactos.org/svn/reactos?rev=39882&view=rev
Log:
- Add more check of parametres in GetDIBits
Modified:
trunk/reactos/dll/win32/gdi32/objects/bitmap.c
Modified: trunk/reactos/dll/win32/gdi32/objects/bitmap.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/objects/bi…
==============================================================================
--- trunk/reactos/dll/win32/gdi32/objects/bitmap.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/gdi32/objects/bitmap.c [iso-8859-1] Thu Mar 5 15:22:35 2009
@@ -418,7 +418,13 @@
}
}
}
- pvSafeBits = RtlAllocateHeap(GetProcessHeap(), 0, cjBmpScanSize);
+
+ if ((ULONG)lpvBits & (sizeof(DWORD) - 1))
+ {
+ pvSafeBits = RtlAllocateHeap(RtlGetProcessHeap(), 0, cjBmpScanSize);
+ if (!pvSafeBits)
+ return Ret;
+ }
}
Ret = NtGdiGetDIBitsInternal(hDC,
@@ -430,9 +436,12 @@
uUsage,
cjBmpScanSize,
0);
- if ( lpvBits != pvSafeBits)
- {
- RtlCopyMemory( lpvBits, pvSafeBits, cjBmpScanSize);
+ if (lpvBits != pvSafeBits)
+ {
+ if (Ret)
+ {
+ RtlCopyMemory(lpvBits, pvSafeBits, cjBmpScanSize);
+ }
RtlFreeHeap(RtlGetProcessHeap(), 0, pvSafeBits);
}
return Ret;