aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Snover2016-09-24 14:24:35 -0500
committerColin Snover2016-09-29 19:39:16 -0500
commit3208f063b50f50ba643b94846d096f1d2b298d23 (patch)
tree4070aaa4073362f5b36cdf0c156b0a31d3905080
parent9a64c0587bbbb68d80130149ec03a9c592bc5e2a (diff)
downloadscummvm-rg350-3208f063b50f50ba643b94846d096f1d2b298d23.tar.gz
scummvm-rg350-3208f063b50f50ba643b94846d096f1d2b298d23.tar.bz2
scummvm-rg350-3208f063b50f50ba643b94846d096f1d2b298d23.zip
SCI32: Extra bounds checking in CelObj renderer
-rw-r--r--engines/sci/graphics/celobj32.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/engines/sci/graphics/celobj32.cpp b/engines/sci/graphics/celobj32.cpp
index 03e2114695..5d2d5dd6a6 100644
--- a/engines/sci/graphics/celobj32.cpp
+++ b/engines/sci/graphics/celobj32.cpp
@@ -154,6 +154,7 @@ struct SCALER_NoScale {
template<bool FLIP, typename READER>
struct SCALER_Scale {
#ifndef NDEBUG
+ int16 _minX;
int16 _maxX;
#endif
const byte *_row;
@@ -165,6 +166,7 @@ struct SCALER_Scale {
SCALER_Scale(const CelObj &celObj, const Common::Rect &targetRect, const Common::Point &scaledPosition, const Ratio scaleX, const Ratio scaleY) :
_row(nullptr),
#ifndef NDEBUG
+ _minX(targetRect.left),
_maxX(targetRect.right - 1),
#endif
// The maximum width of the scaled object may not be as
@@ -234,11 +236,11 @@ struct SCALER_Scale {
inline void setTarget(const int16 x, const int16 y) {
_row = _reader.getRow(_valuesY[y]);
_x = x;
- assert(_x >= 0 && _x <= _maxX);
+ assert(_x >= _minX && _x <= _maxX);
}
inline byte read() {
- assert(_x >= 0 && _x <= _maxX);
+ assert(_x >= _minX && _x <= _maxX);
return _row[_valuesX[_x++]];
}
};