[Scummvm-git-logs] scummvm master -> 5eacfb436d74974d76be60e960f834d0b943db83

sev- noreply at scummvm.org
Wed Oct 1 09:27:03 UTC 2025


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:
5eacfb436d WAGE: Made Design rendering even more robust and added debug output


Commit: 5eacfb436d74974d76be60e960f834d0b943db83
    https://github.com/scummvm/scummvm/commit/5eacfb436d74974d76be60e960f834d0b943db83
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-10-01T11:26:23+02:00

Commit Message:
WAGE: Made Design rendering even more robust and added debug output

Changed paths:
    engines/wage/design.cpp


diff --git a/engines/wage/design.cpp b/engines/wage/design.cpp
index 00e8aa3c6f8..48dbb1b29ad 100644
--- a/engines/wage/design.cpp
+++ b/engines/wage/design.cpp
@@ -548,6 +548,18 @@ void Design::drawOval(Graphics::ManagedSurface *surface, Common::ReadStream &in,
 
 void Design::drawBitmap(Graphics::ManagedSurface *surface, Common::SeekableReadStream &in) {
 	int numBytes = in.readSint16BE();
+
+	// Check for broken bitmap data
+	if (numBytes < 10) {
+		if (numBytes > 2) {
+			warning("Design::drawBitmap(): Broken bitmap data");
+			in.seek(numBytes - 2, SEEK_CUR);
+		} else {
+			warning("Design::drawBitmap(): Completely broken bitmap data");
+		}
+		return;
+	}
+
 	int y1 = in.readSint16BE();
 	int x1 = in.readSint16BE();
 	int y2 = in.readSint16BE();
@@ -609,10 +621,18 @@ void Design::drawBitmap(Graphics::ManagedSurface *surface, Common::SeekableReadS
 					break;
 				}
 			}
+
+			if (numBytes <= 0) {
+				warning("Design::drawBitmap(): Bitmap data ended prematurely");
+				break;
+			}
 		}
 	}
 
-	in.seek(numBytes, SEEK_CUR);
+	if (numBytes > 0)
+		in.seek(numBytes, SEEK_CUR);
+	else if (numBytes < 0)
+		warning("Design::drawBitmap(): Read past the end of bitmap data (%d bytes)", numBytes);
 
 	if (!_boundsCalculationMode) {
 		Graphics::FloodFill ff(&tmp, kColorWhite, kColorGreen);




More information about the Scummvm-git-logs mailing list