aboutsummaryrefslogtreecommitdiff
path: root/image
diff options
context:
space:
mode:
authorBastien Bouclet2018-09-13 22:53:37 +0200
committerBastien Bouclet2018-09-14 19:54:52 +0200
commit360e1e97c9c5452431170d2724b3840b817aa5f8 (patch)
tree676ddee704890569cebfe1c27ba8fe90458de4ae /image
parentf0f02c4a3f1be13058c2334bae694312a315a030 (diff)
downloadscummvm-rg350-360e1e97c9c5452431170d2724b3840b817aa5f8.tar.gz
scummvm-rg350-360e1e97c9c5452431170d2724b3840b817aa5f8.tar.bz2
scummvm-rg350-360e1e97c9c5452431170d2724b3840b817aa5f8.zip
IMAGE: Check the output surface bounds when writing QT encoded PICT images
Diffstat (limited to 'image')
-rw-r--r--image/pict.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/image/pict.cpp b/image/pict.cpp
index 4f4f0396bf..1a1d03d7de 100644
--- a/image/pict.cpp
+++ b/image/pict.cpp
@@ -577,9 +577,14 @@ void PICTDecoder::decodeCompressedQuickTime(Common::SeekableReadStream &stream)
_outputSurface = new Graphics::Surface();
_outputSurface->create(_imageRect.width(), _imageRect.height(), surface->format);
}
+ assert(_outputSurface->format == surface->format);
- for (uint16 y = 0; y < surface->h; y++)
- memcpy(_outputSurface->getBasePtr(0 + xOffset, y + yOffset), surface->getBasePtr(0, y), surface->w * surface->format.bytesPerPixel);
+ Common::Rect outputRect(surface->w, surface->h);
+ outputRect.translate(xOffset, yOffset);
+ outputRect.clip(_imageRect);
+
+ for (uint16 y = 0; y < outputRect.height(); y++)
+ memcpy(_outputSurface->getBasePtr(outputRect.left, y + outputRect.top), surface->getBasePtr(0, y), outputRect.width() * surface->format.bytesPerPixel);
stream.seek(startPos + dataSize);
delete codec;