From 7989d65b26fa0788db05c8a9f49d7be4cab80722 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 31 Dec 2019 17:06:03 +0100 Subject: DIRECTOR: Add sanity check to BITDDecoder --- engines/director/images.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'engines') diff --git a/engines/director/images.cpp b/engines/director/images.cpp index 3d031c7518..10d73accc1 100644 --- a/engines/director/images.cpp +++ b/engines/director/images.cpp @@ -107,6 +107,12 @@ bool DIBDecoder::loadStream(Common::SeekableReadStream &stream) { BITDDecoder::BITDDecoder(int w, int h, uint16 bitsPerPixel, uint16 pitch) { _surface = new Graphics::Surface(); + if (pitch < w) { + warning("BITDDecoder: pitch is too small: %d < %d", pitch, w); + + pitch = w; + } + Graphics::PixelFormat pf = Graphics::PixelFormat::createFormatCLUT8(); switch (bitsPerPixel) { case 2: -- cgit v1.2.3