[Scummvm-git-logs] scummvm master -> 6fb49b65955d34bc4f3cdc37afb9908faf81dd42

sev- sev at scummvm.org
Wed Aug 19 12:55:11 UTC 2020


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
cc14dede0f DIRECTOR: More debug output to DV
6fb49b6595 IMAGE: Added sanity checks to SMC video decoder


Commit: cc14dede0f02aecfb973cfd4baef87a6b471f84d
    https://github.com/scummvm/scummvm/commit/cc14dede0f02aecfb973cfd4baef87a6b471f84d
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-08-19T14:54:30+02:00

Commit Message:
DIRECTOR: More debug output to DV

Changed paths:
    engines/director/castmember.cpp


diff --git a/engines/director/castmember.cpp b/engines/director/castmember.cpp
index 5ce36f98aa..eba1742109 100644
--- a/engines/director/castmember.cpp
+++ b/engines/director/castmember.cpp
@@ -308,7 +308,7 @@ bool DigitalVideoCastMember::loadVideo(Common::String path) {
 }
 
 bool DigitalVideoCastMember::isModified() {
-	if (!_video)
+	if (!_video || !_video->isVideoLoaded())
 		return false;
 
 	return _video->needsUpdate();
@@ -333,10 +333,10 @@ Graphics::MacWidget *DigitalVideoCastMember::createWidget(Common::Rect &bbox, Ch
 			_channel->_stopTime = getMovieTotalTime();
 	}
 
+	debugC(2, kDebugImages, "Video time: %d  rate: %f", _channel->_movieTime, _channel->_movieRate);
 	const Graphics::Surface *frame = _video->decodeNextFrame();
 
 	_channel->_movieTime = getMovieCurrentTime();
-	debugC(2, kDebugImages, "Video time: %d", _channel->_movieTime);
 
 	if (frame) {
 		if (g_director->_pixelformat.bytesPerPixel == 1) {


Commit: 6fb49b65955d34bc4f3cdc37afb9908faf81dd42
    https://github.com/scummvm/scummvm/commit/6fb49b65955d34bc4f3cdc37afb9908faf81dd42
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-08-19T14:54:47+02:00

Commit Message:
IMAGE: Added sanity checks to SMC video decoder

Changed paths:
    image/codecs/smc.cpp


diff --git a/image/codecs/smc.cpp b/image/codecs/smc.cpp
index 716b2f96fd..38693009f1 100644
--- a/image/codecs/smc.cpp
+++ b/image/codecs/smc.cpp
@@ -83,6 +83,8 @@ const Graphics::Surface *SMCDecoder::decodeFrame(Common::SeekableReadStream &str
 
 	int32 totalBlocks = ((_surface->w + 3) / 4) * ((_surface->h + 3) / 4);
 
+	uint32 pixelSize = _surface->w * _surface->h;
+
 	// traverse through the blocks
 	while (totalBlocks != 0) {
 		// sanity checks
@@ -132,8 +134,12 @@ const Graphics::Surface *SMCDecoder::decodeFrame(Common::SeekableReadStream &str
 				blockPtr = rowPtr + pixelPtr;
 				prevBlockPtr = prevBlockPtr1;
 				for (byte y = 0; y < 4; y++) {
-					for (byte x = 0; x < 4; x++)
+					for (byte x = 0; x < 4; x++) {
+						if (blockPtr >= pixelSize)
+							break;
+
 						pixels[blockPtr++] = pixels[prevBlockPtr++];
+					}
 					blockPtr += rowInc;
 					prevBlockPtr += rowInc;
 				}
@@ -178,8 +184,12 @@ const Graphics::Surface *SMCDecoder::decodeFrame(Common::SeekableReadStream &str
 				prevBlockFlag = !prevBlockFlag;
 
 				for (byte y = 0; y < 4; y++) {
-					for (byte x = 0; x < 4; x++)
+					for (byte x = 0; x < 4; x++) {
+						if (blockPtr >= pixelSize)
+							break;
+
 						pixels[blockPtr++] = pixels[prevBlockPtr++];
+					}
 
 					blockPtr += rowInc;
 					prevBlockPtr += rowInc;
@@ -197,8 +207,12 @@ const Graphics::Surface *SMCDecoder::decodeFrame(Common::SeekableReadStream &str
 			while (numBlocks--) {
 				blockPtr = rowPtr + pixelPtr;
 				for (byte y = 0; y < 4; y++) {
-					for (byte x = 0; x < 4; x++)
+					for (byte x = 0; x < 4; x++) {
+						if (blockPtr >= pixelSize)
+							break;
+
 						pixels[blockPtr++] = pixel;
+					}
 
 					blockPtr += rowInc;
 				}
@@ -243,6 +257,10 @@ const Graphics::Surface *SMCDecoder::decodeFrame(Common::SeekableReadStream &str
 							pixel = colorTableIndex;
 
 						flagMask >>= 1;
+
+						if (blockPtr >= pixelSize)
+							break;
+
 						pixels[blockPtr++] = _colorPairs[pixel];
 					}
 
@@ -288,6 +306,10 @@ const Graphics::Surface *SMCDecoder::decodeFrame(Common::SeekableReadStream &str
 					for (byte x = 0; x < 4; x++) {
 						pixel = colorTableIndex + ((colorFlags >> flagMask) & 0x03);
 						flagMask -= 2;
+
+						if (blockPtr >= pixelSize)
+							break;
+
 						pixels[blockPtr++] = _colorQuads[pixel];
 					}
 					blockPtr += rowInc;
@@ -352,6 +374,10 @@ const Graphics::Surface *SMCDecoder::decodeFrame(Common::SeekableReadStream &str
 					for (byte x = 0; x < 4; x++) {
 						pixel = colorTableIndex + ((colorFlags >> flagMask) & 0x07);
 						flagMask -= 3;
+
+						if (blockPtr >= pixelSize)
+							break;
+
 						pixels[blockPtr++] = _colorOctets[pixel];
 					}
 
@@ -368,8 +394,12 @@ const Graphics::Surface *SMCDecoder::decodeFrame(Common::SeekableReadStream &str
 			while (numBlocks--) {
 				blockPtr = rowPtr + pixelPtr;
 				for (byte y = 0; y < 4; y++) {
-					for (byte x = 0; x < 4; x++)
+					for (byte x = 0; x < 4; x++) {
+						if (blockPtr >= pixelSize)
+							break;
+
 						pixels[blockPtr++] = stream.readByte();
+					}
 
 					blockPtr += rowInc;
 				}




More information about the Scummvm-git-logs mailing list