From f0eb59cdee3f8ac0152b6075f68db6d6a9784f85 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 16 Aug 2019 10:36:55 +0200 Subject: HDB: Draw all stars/snow in PPC version. Along the way, this caught a buffer overflow, so sanity checks were also implemented --- engines/hdb/gfx.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'engines') diff --git a/engines/hdb/gfx.cpp b/engines/hdb/gfx.cpp index 4ebb052705..5d8f5cae4c 100644 --- a/engines/hdb/gfx.cpp +++ b/engines/hdb/gfx.cpp @@ -522,7 +522,11 @@ Tile *Gfx::loadIcon(const char *tileName) { } void Gfx::setPixel(int x, int y, uint16 color) { + if (x < 0 || y < 0 || x >= _globalSurface.w || y >= _globalSurface.h) + return; + *(uint16 *)_globalSurface.getBasePtr(x, y) = color; + g_system->copyRectToScreen(_globalSurface.getBasePtr(x, y), _globalSurface.pitch, x, y, 1, 1); } Tile *Gfx::getTile(int index) { -- cgit v1.2.3