From 4b482b2d3e32e834eefb4d6af1a175f2b2ac75da Mon Sep 17 00:00:00 2001 From: Thanasis Antoniou Date: Sun, 28 Jul 2019 14:05:26 +0300 Subject: BLADERUNNER: prevent seg fault in ESPER Also added CLIP to all getBasePtr() calls where it would seem appropriate/safer to do so --- engines/bladerunner/vqa_decoder.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/bladerunner/vqa_decoder.cpp') diff --git a/engines/bladerunner/vqa_decoder.cpp b/engines/bladerunner/vqa_decoder.cpp index 68737858ca..cb7028f764 100644 --- a/engines/bladerunner/vqa_decoder.cpp +++ b/engines/bladerunner/vqa_decoder.cpp @@ -839,7 +839,7 @@ void VQADecoder::VQAVideoTrack::VPTRWriteBlock(Graphics::Surface *surface, unsig uint16 outColor = (uint16)surface->format.RGBToColor(r, g, b); if (!(alpha && a)) { - *(uint16 *)(surface->getBasePtr(dst_x + x, dst_y + y)) = outColor; + *(uint16 *)(surface->getBasePtr(CLIP(dst_x + x, (uint32)0, (uint32)(surface->w - 1)), CLIP(dst_y + y, (uint32)0, (uint32)(surface->h - 1)))) = outColor; } } } -- cgit v1.2.3