[Scummvm-git-logs] scummvm master -> 21955df19b580dad2807ec55f573b5f348690a81

bluegr noreply at scummvm.org
Mon Oct 26 07:34:05 UTC 2026


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

Summary:
21955df19b IMAGE: INDEO3: Fix garbage on padded frames


Commit: 21955df19b580dad2807ec55f573b5f348690a81
    https://github.com/scummvm/scummvm/commit/21955df19b580dad2807ec55f573b5f348690a81
Author: Nikita Lebedev (nest-aka-swan at yandex.ru)
Date: 2026-10-26T09:34:00+02:00

Commit Message:
IMAGE: INDEO3: Fix garbage on padded frames

Indeo 3 rounds the coded frame size up to a multiple of 4, so a frame
can be slightly larger than the stream. The scale factor then became
0, which crashed with a division by zero on x86 and drew garbage on
ARM. Crop such frames in the existing upscale path instead.
Seen in whostolehanukkah, where a 169x184 QuickTime video is coded
as 172x184.

Assisted-by: Claude:claude-opus-5-5

Changed paths:
    image/codecs/indeo3.cpp


diff --git a/image/codecs/indeo3.cpp b/image/codecs/indeo3.cpp
index 6840de820b3..e95d64d4c38 100644
--- a/image/codecs/indeo3.cpp
+++ b/image/codecs/indeo3.cpp
@@ -288,22 +288,22 @@ const Graphics::Surface *Indeo3Decoder::decodeFrame(Common::SeekableReadStream &
 			chromaWidth + 1);
 
 	// Blit the frame onto the surface
-	uint32 scaleWidth  = _surface->w / fWidth;
-	uint32 scaleHeight = _surface->h / fHeight;
+	uint32 scaleWidth  = MAX<uint32>(_surface->w / fWidth, 1);
+	uint32 scaleHeight = MAX<uint32>(_surface->h / fHeight, 1);
 
-	if (scaleWidth == 1 && scaleHeight == 1) {
+	if (scaleWidth == 1 && scaleHeight == 1 && fWidth <= _surface->w && fHeight <= _surface->h) {
 		// Shortcut: Don't need to scale so we can decode straight to the surface
 		YUVToRGBMan.convert410(_surface, Graphics::YUVToRGBManager::kScaleITU, srcY, tempU, tempV,
 				fWidth, fHeight, fWidth, chromaWidth + 1);
 	} else {
-		// Need to upscale, so decode to a temp surface first
+		// Need to upscale or crop, so decode to a temp surface first
 		Graphics::Surface tempSurface;
 		tempSurface.create(fWidth, fHeight, _surface->format);
 
 		YUVToRGBMan.convert410(&tempSurface, Graphics::YUVToRGBManager::kScaleITU, srcY, tempU, tempV,
 				fWidth, fHeight, fWidth, chromaWidth + 1);
 
-		// Upscale
+		// Upscale or crop
 		for (int y = 0; y < _surface->h; y++) {
 			for (int x = 0; x < _surface->w; x++) {
 				if (_surface->format.bytesPerPixel == 1)




More information about the Scummvm-git-logs mailing list