https://git.reactos.org/?p=reactos.git;a=commitdiff;h=febf9acfeeb71ae6fca7c…
commit febf9acfeeb71ae6fca7c3a659449ef7997458fa
Author: Giannis Adamopoulos <gadamopoulos(a)reactos.org>
AuthorDate: Wed Nov 22 17:28:18 2017 +0200
[GDI32] GdiDrawStream: Improve handling of small rcDest sizes
- Abort drawing if rcDest has negative height or width.
- Ignore sizing margins if rcDest is too small.
CORE-13513
---
win32ss/gdi/gdi32/misc/misc.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/win32ss/gdi/gdi32/misc/misc.c b/win32ss/gdi/gdi32/misc/misc.c
index 65287d0b1d..6675e7335c 100644
--- a/win32ss/gdi/gdi32/misc/misc.c
+++ b/win32ss/gdi/gdi32/misc/misc.c
@@ -677,6 +677,19 @@ GdiDrawStream(HDC dc, ULONG l, PGDI_DRAW_STREAM pDS)
else
sizingtype = ST_STRETCH;
+ if (pDS->rcDest.right < pDS->rcDest.left || pDS->rcDest.bottom <
pDS->rcDest.top)
+ return 0;
+
+ if (sm.cxLeftWidth + sm.cxRightWidth > pDS->rcDest.right -
pDS->rcDest.left)
+ {
+ sm.cxLeftWidth = sm.cxRightWidth = 0;
+ }
+
+ if (sm.cyTopHeight + sm.cyBottomHeight > pDS->rcDest.bottom -
pDS->rcDest.top)
+ {
+ sm.cyTopHeight = sm.cyBottomHeight = 0;
+ }
+
UXTHEME_DrawImageBackground(pDS->hDC,
pDS->hImage,
&pDS->rcSrc,