diff options
author | Eugene Sandulenko | 2016-08-23 08:14:39 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2016-08-23 08:15:13 +0200 |
commit | 812a43d5590b0212663729c58bdbf0a951f1a12c (patch) | |
tree | 080a3b8980952dd0a9dcc10008994c3a079d81c8 /engines | |
parent | 1c19029c5817038da66a1837997ba994337fdea2 (diff) | |
download | scummvm-rg350-812a43d5590b0212663729c58bdbf0a951f1a12c.tar.gz scummvm-rg350-812a43d5590b0212663729c58bdbf0a951f1a12c.tar.bz2 scummvm-rg350-812a43d5590b0212663729c58bdbf0a951f1a12c.zip |
DIRECTOR: Fix memory overwrite
Diffstat (limited to 'engines')
-rw-r--r-- | engines/director/images.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/engines/director/images.cpp b/engines/director/images.cpp index a339ce7804..db149eba1f 100644 --- a/engines/director/images.cpp +++ b/engines/director/images.cpp @@ -87,7 +87,7 @@ bool DIBDecoder::loadStream(Common::SeekableReadStream &stream) { stream.readUint16LE(); // planes uint16 bitsPerPixel = stream.readUint16LE(); uint32 compression = stream.readUint32BE(); - uint32 imageSize = stream.readUint32LE(); + /* uint32 imageSize = */ stream.readUint32LE(); /* uint32 pixelsPerMeterX = */ stream.readUint32LE(); /* uint32 pixelsPerMeterY = */ stream.readUint32LE(); _paletteColorCount = stream.readUint32LE(); @@ -95,7 +95,6 @@ bool DIBDecoder::loadStream(Common::SeekableReadStream &stream) { _paletteColorCount = (_paletteColorCount == 0) ? 255: _paletteColorCount; - uint16 imageRawSize = stream.size() - 40; Common::SeekableSubReadStream subStream(&stream, 40, stream.size()); _codec = Image::createBitmapCodec(compression, width, height, bitsPerPixel); @@ -120,7 +119,7 @@ BITDDecoder::BITDDecoder(int w, int h) { _surface = new Graphics::Surface(); _surface->create(w, h, Graphics::PixelFormat::createFormatCLUT8()); - _palette = new byte[255 * 3]; + _palette = new byte[256 * 3]; _palette[0] = _palette[1] = _palette[2] = 0; _palette[255 * 3 + 0] = _palette[255 * 3 + 1] = _palette[255 * 3 + 2] = 0xff; @@ -175,7 +174,7 @@ bool BITDDecoder::loadStream(Common::SeekableReadStream &stream) { color = b; for (int c = 0; c < 8; c++) { - *((byte *)_surface->getBasePtr(x, y)) = (color & (1 << (7 - c % 8))) ? 0 : 0xff; + *((byte *)_surface->getBasePtr(x, y)) = (color & (1 << (7 - c))) ? 0 : 0xff; x++; if (x == _surface->w) { y++; |