[Scummvm-git-logs] scummvm master -> 9862969f6942036d33a9736d803b5a41aa38fd7b

sev- noreply at scummvm.org
Sun Aug 6 12:08:34 UTC 2023


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:
9862969f69 GRAPHICS: Make setPixel assert in attempts to draw outside of the surface


Commit: 9862969f6942036d33a9736d803b5a41aa38fd7b
    https://github.com/scummvm/scummvm/commit/9862969f6942036d33a9736d803b5a41aa38fd7b
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2023-08-06T14:07:43+02:00

Commit Message:
GRAPHICS: Make setPixel assert in attempts to draw outside of the surface

Based on PR#5011 by phcoder.

Expect some of your engines to fail during runtime, fix them.

Changed paths:
    graphics/surface.h


diff --git a/graphics/surface.h b/graphics/surface.h
index 355a8d2bc84..8d56d2f8316 100644
--- a/graphics/surface.h
+++ b/graphics/surface.h
@@ -181,6 +181,7 @@ public:
 	 */
 	inline void setPixel(int x, int y, int pixel) {
 		assert(format.bytesPerPixel > 0 && format.bytesPerPixel <= 4);
+		assert(x >= 0 && x < w && y >= 0 && y < h);
 		if (format.bytesPerPixel == 1)
 			*((uint8 *)getBasePtr(x, y)) = pixel;
 		else if (format.bytesPerPixel == 2)




More information about the Scummvm-git-logs mailing list