[Scummvm-git-logs] scummvm master -> 7ec621554795723965d574bd826eb01cfacc6434

criezy criezy at scummvm.org
Tue Mar 16 23:47:09 UTC 2021


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
7ec6215547 GRAPHICS: Fix possible out of bound write for 1bpp blit in ManagedSurface


Commit: 7ec621554795723965d574bd826eb01cfacc6434
    https://github.com/scummvm/scummvm/commit/7ec621554795723965d574bd826eb01cfacc6434
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2021-03-16T23:46:50Z

Commit Message:
GRAPHICS: Fix possible out of bound write for 1bpp blit in ManagedSurface

Changed paths:
    graphics/managed_surface.cpp


diff --git a/graphics/managed_surface.cpp b/graphics/managed_surface.cpp
index 2ea7009b97..3e1c22b220 100644
--- a/graphics/managed_surface.cpp
+++ b/graphics/managed_surface.cpp
@@ -279,7 +279,16 @@ void ManagedSurface::blitFromInner(const Surface &src, const Common::Rect &srcRe
 		// For paletted format, assume the palette is the same and there is no transparency.
 		// We can thus do a straight copy of the pixels.
 		if (format.bytesPerPixel == 1 && noScale) {
-			Common::copy(srcP, srcP + srcRect.width() * format.bytesPerPixel, destP);
+			int width = srcRect.width();
+			if (destRect.left + width > w)
+				width = w - destRect.left;
+			if (destRect.left < 0) {
+				srcP -= destRect.left;
+				destP -= destRect.left;
+				width += destRect.left;
+			}
+			if (width > 0)
+				Common::copy(srcP, srcP + width, destP);
 			continue;
 		}
 




More information about the Scummvm-git-logs mailing list