From dfa2a5809a97879979e4c4c803c1a128421ff852 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Fri, 3 Nov 2017 00:27:22 +1100 Subject: [PATCH] [vendor] fixed out of bounds memory access on negative pointer offsets --- vendor/DXGICapture/DXGIManager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vendor/DXGICapture/DXGIManager.cpp b/vendor/DXGICapture/DXGIManager.cpp index e9932de1..8cbf41d9 100644 --- a/vendor/DXGICapture/DXGIManager.cpp +++ b/vendor/DXGICapture/DXGIManager.cpp @@ -562,9 +562,9 @@ void DXGIManager::DrawMousePointer(BYTE* pDesktopBits, RECT rcDesktop, RECT rcDe // alpha blend the cursor const int maxX = min(shapeInfo.Width , dwDesktopWidth - PtrX); const int maxY = min(shapeInfo.Height, dwDesktopHeight - PtrY); - for(int y = 0; y < maxY; ++y) + for(int y = abs(min(0, PtrY)); y < maxY; ++y) { - for (int x = 0; x < maxX; ++x) + for (int x = abs(min(0, PtrX)); x < maxX; ++x) { BYTE *srcPix = &PtrBuf[y * shapeInfo.Pitch + x * 4]; BYTE *dstPix = &pDesktopBits[((PtrY + y) * dwDesktopWidth * 4) + (PtrX + x) * 4];