[Scummvm-cvs-logs] scummvm master -> fa41ee132b83d99d77349f3e7d647248f2907ff5

m-kiewitz m_kiewitz at users.sourceforge.net
Sat Sep 21 22:36:09 CEST 2013


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:
fa41ee132b SCI: fix for heap corruption during lsl3 ending


Commit: fa41ee132b83d99d77349f3e7d647248f2907ff5
    https://github.com/scummvm/scummvm/commit/fa41ee132b83d99d77349f3e7d647248f2907ff5
Author: m-kiewitz (m_kiewitz at users.sourceforge.net)
Date: 2013-09-21T13:35:53-07:00

Commit Message:
SCI: fix for heap corruption during lsl3 ending

Changed paths:
    engines/sci/graphics/screen.cpp



diff --git a/engines/sci/graphics/screen.cpp b/engines/sci/graphics/screen.cpp
index 7b92bc8..0df163d 100644
--- a/engines/sci/graphics/screen.cpp
+++ b/engines/sci/graphics/screen.cpp
@@ -286,11 +286,15 @@ void GfxScreen::putPixelOnDisplay(int x, int y, byte color) {
  * with flood fill, due to small difference in the Bresenham logic.
  */
 void GfxScreen::drawLine(Common::Point startPoint, Common::Point endPoint, byte color, byte priority, byte control) {
-	int16 left = startPoint.x;
-	int16 top = startPoint.y;
-	int16 right = endPoint.x;
-	int16 bottom = endPoint.y;
-
+    int16 maxWidth = _width - 1;
+    int16 maxHeight = _height - 1;
+    // we need to clip values here, lsl3 room 620 background picture draws a line from 0, 199 t 320, 199
+    //  otherwise we would get heap corruption.
+	int16 left = CLIP<int16>(startPoint.x, 0, maxWidth);
+	int16 top = CLIP<int16>(startPoint.y, 0, maxHeight);
+	int16 right = CLIP<int16>(endPoint.x, 0, maxWidth);
+	int16 bottom = CLIP<int16>(endPoint.y, 0, maxHeight);
+	
 	//set_drawing_flag
 	byte drawMask = getDrawingMask(color, priority, control);
 






More information about the Scummvm-git-logs mailing list