Permalink
Browse files

IMAGE: Check the output surface bounds when writing QT encoded PICT i…

…mages
  • Loading branch information...
bgK committed Sep 13, 2018
1 parent f0f02c4 commit 360e1e97c9c5452431170d2724b3840b817aa5f8
Showing with 7 additions and 2 deletions.
  1. +7 −2 image/pict.cpp
View
@@ -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;

0 comments on commit 360e1e9

Please sign in to comment.