diff options
author | Bendegúz Nagy | 2016-08-12 15:27:36 +0200 |
---|---|---|
committer | Bendegúz Nagy | 2016-08-26 23:02:22 +0200 |
commit | 29f5210b3fd2fdd9500cf81e91fbe15d8af827f7 (patch) | |
tree | 30139aad45ad7f0ef861c50546041505126b84a9 /engines | |
parent | 52f76a5d747064f0d61b4508f29edc65f10edf1d (diff) | |
download | scummvm-rg350-29f5210b3fd2fdd9500cf81e91fbe15d8af827f7.tar.gz scummvm-rg350-29f5210b3fd2fdd9500cf81e91fbe15d8af827f7.tar.bz2 scummvm-rg350-29f5210b3fd2fdd9500cf81e91fbe15d8af827f7.zip |
DM: Add sanity check to blitToBimap
Diffstat (limited to 'engines')
-rw-r--r-- | engines/dm/gfx.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/engines/dm/gfx.cpp b/engines/dm/gfx.cpp index 1a1de67585..b5aa123db1 100644 --- a/engines/dm/gfx.cpp +++ b/engines/dm/gfx.cpp @@ -1130,9 +1130,12 @@ void DisplayMan::f132_blitToBitmap(byte *srcBitmap, byte *destBitmap, Box &box, uint16 destWidth = destByteWidth * 2; for (uint16 y = 0; y < box._y2 + 1 - box._y1; ++y) // + 1 for inclusive boundaries for (uint16 x = 0; x < box._x2 + 1 - box._x1; ++x) { // + 1 for inclusive boundaries - byte srcPixel = srcBitmap[srcWidth * (y + srcY) + srcX + x]; - if (srcPixel != transparent) - destBitmap[destWidth * (y + box._y1) + box._x1 + x] = srcPixel; + if (srcX + x < srcWidth && y + srcY < srcHeight + && box._x1 + x < destWidth && y + box._y1 < destHight) { + byte srcPixel = srcBitmap[srcWidth * (y + srcY) + srcX + x]; + if (srcPixel != transparent) + destBitmap[destWidth * (y + box._y1) + box._x1 + x] = srcPixel; + } } } |