From 331a9f49690f59df207b437d36f5147a4e8dbf29 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 4 Feb 2016 18:47:08 -0500 Subject: SHERLOCK: SS: Fix crash on invalid graphics in German version --- engines/sherlock/image_file.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'engines/sherlock/image_file.cpp') diff --git a/engines/sherlock/image_file.cpp b/engines/sherlock/image_file.cpp index 971980a2ac..1247a7f8d0 100644 --- a/engines/sherlock/image_file.cpp +++ b/engines/sherlock/image_file.cpp @@ -172,7 +172,7 @@ void ImageFrame::decompressFrame(const byte *src, bool isRoseTattoo) { while (frameSize > 0) { if (*src == _rleMarker) { byte rleColor = src[1]; - byte rleCount = src[2]; + byte rleCount = MIN((int)src[2], frameSize); src += 3; frameSize -= rleCount; while (rleCount--) @@ -182,7 +182,6 @@ void ImageFrame::decompressFrame(const byte *src, bool isRoseTattoo) { --frameSize; } } - assert(frameSize == 0); } else { // Uncompressed frame Common::copy(src, src + _width * _height, dest); -- cgit v1.2.3