aboutsummaryrefslogtreecommitdiff
path: root/engines/mads/screen.cpp
diff options
context:
space:
mode:
authorFilippos Karapetis2014-05-16 05:03:56 +0300
committerFilippos Karapetis2014-05-16 05:04:25 +0300
commit41c93dc0b5861df729b7da7ea41225e51811a0a5 (patch)
treeda74841755693274fefeaf540d6dc5d592405286 /engines/mads/screen.cpp
parent82064df60a730f792e978db7c29e7280d1604cff (diff)
downloadscummvm-rg350-41c93dc0b5861df729b7da7ea41225e51811a0a5.tar.gz
scummvm-rg350-41c93dc0b5861df729b7da7ea41225e51811a0a5.tar.bz2
scummvm-rg350-41c93dc0b5861df729b7da7ea41225e51811a0a5.zip
MADS: Check if a rect is sane before attempting to create it
Diffstat (limited to 'engines/mads/screen.cpp')
-rw-r--r--engines/mads/screen.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/engines/mads/screen.cpp b/engines/mads/screen.cpp
index 09f87f3f8b..6a70bfb5d9 100644
--- a/engines/mads/screen.cpp
+++ b/engines/mads/screen.cpp
@@ -206,6 +206,10 @@ void DirtyAreas::copy(MSurface *srcSurface, MSurface *destSurface, const Common:
for (uint i = 0; i < size(); ++i) {
const Common::Rect &srcBounds = (*this)[i]._bounds;
+ // Check if this is a sane rectangle before attempting to create it
+ if (srcBounds.left >= srcBounds.right || srcBounds.top >= srcBounds.bottom)
+ continue;
+
Common::Rect bounds(srcBounds.left + posAdjust.x, srcBounds.top + posAdjust.y,
srcBounds.right + posAdjust.x, srcBounds.bottom + posAdjust.y);
@@ -219,6 +223,10 @@ void DirtyAreas::copyToScreen(const Common::Point &posAdjust) {
for (uint i = 0; i < size(); ++i) {
const Common::Rect &srcBounds = (*this)[i]._bounds;
+ // Check if this is a sane rectangle before attempting to create it
+ if (srcBounds.left >= srcBounds.right || srcBounds.top >= srcBounds.bottom)
+ continue;
+
Common::Rect bounds(srcBounds.left + posAdjust.x, srcBounds.top + posAdjust.y,
srcBounds.right + posAdjust.x, srcBounds.bottom + posAdjust.y);