diff options
author | richiesams | 2013-08-17 20:34:44 -0500 |
---|---|---|
committer | richiesams | 2013-08-18 19:52:57 -0500 |
commit | f1d44bdf8cbcf69805713f042b16480227e14d6c (patch) | |
tree | 37cc9784357fb3198dfe52fe8e083cec6dc10955 | |
parent | 80cba07b311a56a9e3dd6ce5ca5a291299b95a8d (diff) | |
download | scummvm-rg350-f1d44bdf8cbcf69805713f042b16480227e14d6c.tar.gz scummvm-rg350-f1d44bdf8cbcf69805713f042b16480227e14d6c.tar.bz2 scummvm-rg350-f1d44bdf8cbcf69805713f042b16480227e14d6c.zip |
ZVISION: Protect against indicies that are more than an imageWidth/Height from the actual image dimensions
-rw-r--r-- | engines/zvision/render_table.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/engines/zvision/render_table.cpp b/engines/zvision/render_table.cpp index 7188530075..ec0cdba7c2 100644 --- a/engines/zvision/render_table.cpp +++ b/engines/zvision/render_table.cpp @@ -114,15 +114,17 @@ void RenderTable::mutateImage(uint16 *sourceBuffer, uint16* destBuffer, int16 im int16 sourceXIndex = x + _internalBuffer[index].x; if (wrap) { - if (sourceXIndex >= imageWidth) { + while (sourceXIndex >= imageWidth) { sourceXIndex -= imageWidth; - } else if (sourceXIndex < 0) { + } + while (sourceXIndex < 0) { sourceXIndex += imageWidth; } - if (sourceYIndex >= imageHeight) { + while (sourceYIndex >= imageHeight) { sourceYIndex -= imageHeight; - } else if (sourceYIndex < 0) { + } + while (sourceYIndex < 0) { sourceYIndex += imageHeight; } } else { |