[Scummvm-git-logs] scummvm master -> 9e6fb74dec51757758b2159e7918a0d5dd24cc7a

bluegr noreply at scummvm.org
Sun May 18 01:56:00 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:
9e6fb74dec SCUMM: Fix out-of-bounds charset error with some v0.13.x saves (Trac#15931)


Commit: 9e6fb74dec51757758b2159e7918a0d5dd24cc7a
    https://github.com/scummvm/scummvm/commit/9e6fb74dec51757758b2159e7918a0d5dd24cc7a
Author: Donovan Watteau (contrib at dwatteau.fr)
Date: 2025-05-18T04:55:57+03:00

Commit Message:
SCUMM: Fix out-of-bounds charset error with some v0.13.x saves (Trac#15931)

I have some Zak V2 saves made with ScummVM 0.13.x which trigger fatal
errors in modern ScummVM.

It looks like, before ScummVM 1.0.0, bogus `_curId` values could be
written, in some cases (although the issue was possibly only happening
in v1-v3 or v1-v2 games).

So, fall back to some default value for it, if we detect such "weird"
values in old saves.

Similar to old commit bd67214c96c1bb1b194cfc31abf05a08afc9cf64.

Changed paths:
    engines/scumm/charset.cpp


diff --git a/engines/scumm/charset.cpp b/engines/scumm/charset.cpp
index e30ab7e1f9b..81c14ae2972 100644
--- a/engines/scumm/charset.cpp
+++ b/engines/scumm/charset.cpp
@@ -1056,6 +1056,13 @@ void CharsetRenderer::saveLoadWithSerializer(Common::Serializer &ser) {
 	ser.syncAsByte(_color, VER(73));
 
 	if (ser.isLoading()) {
+		// Some old v0.13.x saves have bogus values, for some reason (see
+		// bug #15931). When detecting such weird values made before the
+		// v1.0.0 release (VER(80)) that followed it, reinitialize the id
+		// using a, hopefully, sane value.
+		if (ser.getVersion() < VER(80) && _curId > _vm->_numCharsets - 1)
+			_curId = _vm->_string[0]._default.charset;
+
 		setCurID(_curId);
 		setColor(_color);
 	}
@@ -1687,7 +1694,7 @@ CharsetRendererMac::~CharsetRendererMac() {
 }
 
 void CharsetRendererMac::setCurID(int32 id) {
-	if  (id == -1)
+	if (id == -1)
 		return;
 
 	// This should only happen, if it happens at all, with older savegames.




More information about the Scummvm-git-logs mailing list