[Scummvm-git-logs] scummvm master -> 39a77b92943186bd6ee8cec1ca7afbeae5aee03b

lephilousophe noreply at scummvm.org
Sat Feb 7 16:21:59 UTC 2026


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

Summary:
f725d9c738 TEST: Use python3 explicitely
96c9901a6e TEST: Fix warning about signed/unsigned comparison
d89fe6c53f TEST: Allow to build tests with ASan
3fd6465203 TEST: Fix memory leaks in tests using backend
3017d16756 COMMON: Fix ubsan errors
39a77b9294 TEST: Fix UB when shifting sample


Commit: f725d9c738e0bd31656b6bc0c8e3ba5c5775dbac
    https://github.com/scummvm/scummvm/commit/f725d9c738e0bd31656b6bc0c8e3ba5c5775dbac
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2026-02-07T17:20:49+01:00

Commit Message:
TEST: Use python3 explicitely

Changed paths:
    test/cxxtest/cxxtestgen.py


diff --git a/test/cxxtest/cxxtestgen.py b/test/cxxtest/cxxtestgen.py
index 9bcc863ad12..b1a5490f6a5 100755
--- a/test/cxxtest/cxxtestgen.py
+++ b/test/cxxtest/cxxtestgen.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 '''Usage: %s [OPTIONS] <input file(s)>
 Generate test source file for CxxTest.
 


Commit: 96c9901a6ecd858f1fa47b1f7bf7beec0c782805
    https://github.com/scummvm/scummvm/commit/96c9901a6ecd858f1fa47b1f7bf7beec0c782805
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2026-02-07T17:20:49+01:00

Commit Message:
TEST: Fix warning about signed/unsigned comparison

Changed paths:
    test/common/formats/quicktime.h
    test/engines/ultima/ultima8/games/treasure_loader.h
    test/engines/ultima/ultima8/misc/util.h
    test/engines/ultima/ultima8/usecode/bit_set.h
    test/engines/ultima/ultima8/usecode/uc_list.h
    test/engines/ultima/ultima8/usecode/uc_stack.h


diff --git a/test/common/formats/quicktime.h b/test/common/formats/quicktime.h
index 93f44d7ec51..36f48ea5de2 100644
--- a/test/common/formats/quicktime.h
+++ b/test/common/formats/quicktime.h
@@ -68,7 +68,7 @@ public:
 		Common::MemoryReadStream stream(VALID_MHDR_DATA, sizeof(VALID_MHDR_DATA));
 		bool result = parser.parseStream(&stream, DisposeAfterUse::NO);
 		TS_ASSERT(result);
-		TS_ASSERT_EQUALS(parser.getDuration(), 999*60 + 1);
+		TS_ASSERT_EQUALS(parser.getDuration(), 999u*60 + 1);
 		TS_ASSERT_EQUALS(parser.getScaleFactorX(), Common::Rational(0x10000, 0x8000));
 		TS_ASSERT_EQUALS(parser.getScaleFactorY(), Common::Rational(0x10000, 0xa000));
 	}
diff --git a/test/engines/ultima/ultima8/games/treasure_loader.h b/test/engines/ultima/ultima8/games/treasure_loader.h
index 6655de8c654..14d6634c750 100644
--- a/test/engines/ultima/ultima8/games/treasure_loader.h
+++ b/test/engines/ultima/ultima8/games/treasure_loader.h
@@ -31,16 +31,16 @@ class U8TreasureLoaderTestSuite : public CxxTest::TestSuite {
 		bool result = loader.parse("shape=123,456 frame=2,3 count=4-20 map=23 chance=0.234", t);
 		TS_ASSERT(result);
 
-		TS_ASSERT_EQUALS(t.size(), 1);
+		TS_ASSERT_EQUALS(t.size(), 1u);
 		const Ultima::Ultima8::TreasureInfo ti = t[0];
-		TS_ASSERT_EQUALS(ti._shapes.size(), 2);
-		TS_ASSERT_EQUALS(ti._shapes[0], 123);
-		TS_ASSERT_EQUALS(ti._shapes[1], 456);
-		TS_ASSERT_EQUALS(ti._frames.size(), 2);
-		TS_ASSERT_EQUALS(ti._frames[0], 2);
-		TS_ASSERT_EQUALS(ti._frames[1], 3);
-		TS_ASSERT_EQUALS(ti._minCount, 4);
-		TS_ASSERT_EQUALS(ti._maxCount, 20);
+		TS_ASSERT_EQUALS(ti._shapes.size(), 2u);
+		TS_ASSERT_EQUALS(ti._shapes[0], 123u);
+		TS_ASSERT_EQUALS(ti._shapes[1], 456u);
+		TS_ASSERT_EQUALS(ti._frames.size(), 2u);
+		TS_ASSERT_EQUALS(ti._frames[0], 2u);
+		TS_ASSERT_EQUALS(ti._frames[1], 3u);
+		TS_ASSERT_EQUALS(ti._minCount, 4u);
+		TS_ASSERT_EQUALS(ti._maxCount, 20u);
 		TS_ASSERT_EQUALS(ti._special, "");
 		TS_ASSERT_EQUALS(ti._map, 23);
 		TS_ASSERT_EQUALS(ti._chance, 0.234);
@@ -53,27 +53,27 @@ class U8TreasureLoaderTestSuite : public CxxTest::TestSuite {
 		bool result = loader.parse("shape=123;shape=456 frame=2-5;shape=888 map=-12", t);
 		TS_ASSERT(result);
 
-		TS_ASSERT_EQUALS(t.size(), 3);
+		TS_ASSERT_EQUALS(t.size(), 3u);
 
-		TS_ASSERT_EQUALS(t[0]._shapes.size(), 1);
-		TS_ASSERT_EQUALS(t[0]._shapes[0], 123);
-		TS_ASSERT_EQUALS(t[0]._frames.size(), 0);
-		TS_ASSERT_EQUALS(t[0]._minCount, 1);
-		TS_ASSERT_EQUALS(t[0]._maxCount, 1);
+		TS_ASSERT_EQUALS(t[0]._shapes.size(), 1u);
+		TS_ASSERT_EQUALS(t[0]._shapes[0], 123u);
+		TS_ASSERT_EQUALS(t[0]._frames.size(), 0u);
+		TS_ASSERT_EQUALS(t[0]._minCount, 1u);
+		TS_ASSERT_EQUALS(t[0]._maxCount, 1u);
 		TS_ASSERT_EQUALS(t[0]._special, "");
 		TS_ASSERT_EQUALS(t[0]._map, 0);
-		TS_ASSERT_EQUALS(t[0]._chance, 1);
-
-		TS_ASSERT_EQUALS(t[1]._shapes.size(), 1);
-		TS_ASSERT_EQUALS(t[1]._shapes[0], 456);
-		TS_ASSERT_EQUALS(t[1]._frames.size(), 4);
-		TS_ASSERT_EQUALS(t[1]._frames[0], 2);
-		TS_ASSERT_EQUALS(t[1]._frames[1], 3);
-		TS_ASSERT_EQUALS(t[1]._frames[2], 4);
-		TS_ASSERT_EQUALS(t[1]._frames[3], 5);
-
-		TS_ASSERT_EQUALS(t[2]._shapes.size(), 1);
-		TS_ASSERT_EQUALS(t[2]._shapes[0], 888);
+		TS_ASSERT_EQUALS(t[0]._chance, 1u);
+
+		TS_ASSERT_EQUALS(t[1]._shapes.size(), 1u);
+		TS_ASSERT_EQUALS(t[1]._shapes[0], 456u);
+		TS_ASSERT_EQUALS(t[1]._frames.size(), 4u);
+		TS_ASSERT_EQUALS(t[1]._frames[0], 2u);
+		TS_ASSERT_EQUALS(t[1]._frames[1], 3u);
+		TS_ASSERT_EQUALS(t[1]._frames[2], 4u);
+		TS_ASSERT_EQUALS(t[1]._frames[3], 5u);
+
+		TS_ASSERT_EQUALS(t[2]._shapes.size(), 1u);
+		TS_ASSERT_EQUALS(t[2]._shapes[0], 888u);
 		TS_ASSERT_EQUALS(t[2]._map, -12);
 	}
 
diff --git a/test/engines/ultima/ultima8/misc/util.h b/test/engines/ultima/ultima8/misc/util.h
index 5662f38122c..ff9bdd7f1e5 100644
--- a/test/engines/ultima/ultima8/misc/util.h
+++ b/test/engines/ultima/ultima8/misc/util.h
@@ -15,18 +15,18 @@ class U8UtilTestSuite : public CxxTest::TestSuite {
 		Common::Array<Common::String> v1;
 		Ultima::Ultima8::SplitString(s1, ',', v1);
 
-		TS_ASSERT_EQUALS(v1.size(), 2);
+		TS_ASSERT_EQUALS(v1.size(), 2u);
 		TS_ASSERT_EQUALS(v1[0], "abc");
 		TS_ASSERT_EQUALS(v1[1], "def");
 
 		Common::String s2;
 		Common::Array<Common::String> v2;
 		Ultima::Ultima8::SplitString(s2, ',', v1);
-		TS_ASSERT_EQUALS(v1.size(), 0);
+		TS_ASSERT_EQUALS(v1.size(), 0u);
 
 		Common::String s3 = " aa  bb  ";
 		Ultima::Ultima8::SplitString(s3, ' ', v1);
-		TS_ASSERT_EQUALS(v1.size(), 6);
+		TS_ASSERT_EQUALS(v1.size(), 6u);
 		TS_ASSERT_EQUALS(v1[0], "");
 		TS_ASSERT_EQUALS(v1[1], "aa");
 	}
@@ -35,12 +35,12 @@ class U8UtilTestSuite : public CxxTest::TestSuite {
 		Common::Array<Common::String> v;
 		Common::String s;
 		Ultima::Ultima8::StringToArgv(s, v);
-		TS_ASSERT_EQUALS(v.size(), 0);
+		TS_ASSERT_EQUALS(v.size(), 0u);
 
 		// Test it strips leading space on args, and includes spaces inside ""s
 		s = "abc \\t\\nescape \"\\ me\\ \\\" !\" ";
 		Ultima::Ultima8::StringToArgv(s, v);
-		TS_ASSERT_EQUALS(v.size(), 3);
+		TS_ASSERT_EQUALS(v.size(), 3u);
 		TS_ASSERT_EQUALS(v[0], "abc");
 		TS_ASSERT_EQUALS(v[1], "escape");
 		TS_ASSERT_EQUALS(v[2], " me \" !");
diff --git a/test/engines/ultima/ultima8/usecode/bit_set.h b/test/engines/ultima/ultima8/usecode/bit_set.h
index 340c1dba2ee..9db13d8456a 100644
--- a/test/engines/ultima/ultima8/usecode/bit_set.h
+++ b/test/engines/ultima/ultima8/usecode/bit_set.h
@@ -16,20 +16,20 @@ class U8BitSetTestSuite : public CxxTest::TestSuite {
 		// Test with bit pattern in second byte of 01110100
 		// (pos goes from low bit to high bit)
 		bs.setEntries(10, 5, 0x1D);
-		TS_ASSERT_EQUALS(bs.getEntries(10, 5), 0x1D);
-		TS_ASSERT_EQUALS(bs.getEntries(10, 4), 0xD);
-		TS_ASSERT_EQUALS(bs.getEntries(8, 6), 0xD << 2);
-		TS_ASSERT_EQUALS(bs.getEntries(8, 7), 0x1D << 2);
-		TS_ASSERT_EQUALS(bs.getEntries(8, 8), 0x1D << 2);
-		TS_ASSERT_EQUALS(bs.getEntries(14, 2), 0x1);
-		TS_ASSERT_EQUALS(bs.getEntries(16, 32), 0);
-		TS_ASSERT_EQUALS(bs.getEntries(0, 10), 0);
+		TS_ASSERT_EQUALS(bs.getEntries(10, 5), 0x1Du);
+		TS_ASSERT_EQUALS(bs.getEntries(10, 4), 0xDu);
+		TS_ASSERT_EQUALS(bs.getEntries(8, 6), 0xDu << 2);
+		TS_ASSERT_EQUALS(bs.getEntries(8, 7), 0x1Du << 2);
+		TS_ASSERT_EQUALS(bs.getEntries(8, 8), 0x1Du << 2);
+		TS_ASSERT_EQUALS(bs.getEntries(14, 2), 0x1u);
+		TS_ASSERT_EQUALS(bs.getEntries(16, 32), 0u);
+		TS_ASSERT_EQUALS(bs.getEntries(0, 10), 0u);
 	}
 
 	void test_clear() {
 		bs.setEntries(10, 5, 0x15);
 		bs.setSize(0x1000);
-		TS_ASSERT_EQUALS(bs.getEntries(10, 5), 0);
-		TS_ASSERT_EQUALS(bs.getEntries(0, 32), 0);
+		TS_ASSERT_EQUALS(bs.getEntries(10, 5), 0u);
+		TS_ASSERT_EQUALS(bs.getEntries(0, 32), 0u);
 	}
 };
diff --git a/test/engines/ultima/ultima8/usecode/uc_list.h b/test/engines/ultima/ultima8/usecode/uc_list.h
index 3342cabb782..22c41c16388 100644
--- a/test/engines/ultima/ultima8/usecode/uc_list.h
+++ b/test/engines/ultima/ultima8/usecode/uc_list.h
@@ -12,25 +12,25 @@ class U8UCListTestSuite : public CxxTest::TestSuite {
 	void test_static_list() {
 		Ultima::Ultima8::UCList l(2);
 
-		TS_ASSERT_EQUALS(l.getSize(), 0);
-		TS_ASSERT_EQUALS(l.getElementSize(), 2);
+		TS_ASSERT_EQUALS(l.getSize(), 0u);
+		TS_ASSERT_EQUALS(l.getElementSize(), 2u);
 
 		uint16 test = 0xBEEF;
 		l.append((uint8*)&test);
-		TS_ASSERT_EQUALS(l.getSize(), 1);
+		TS_ASSERT_EQUALS(l.getSize(), 1u);
 
 		uint16 test2 = 0xF00D;
 		l.append((uint8*)&test2);
-		TS_ASSERT_EQUALS(l.getSize(), 2);
+		TS_ASSERT_EQUALS(l.getSize(), 2u);
 		TS_ASSERT(l.inList((uint8*)&test));
 
 		l.remove((uint8*)&test);
 		TS_ASSERT(!l.inList((uint8*)&test));
 		TS_ASSERT(l.inList((uint8*)&test2));
-		TS_ASSERT_EQUALS(l.getSize(), 1);
+		TS_ASSERT_EQUALS(l.getSize(), 1u);
 
 		l.free();
-		TS_ASSERT_EQUALS(l.getSize(), 0);
+		TS_ASSERT_EQUALS(l.getSize(), 0u);
 	}
 
 };
diff --git a/test/engines/ultima/ultima8/usecode/uc_stack.h b/test/engines/ultima/ultima8/usecode/uc_stack.h
index 9f34bb5b833..0fe87aebdce 100644
--- a/test/engines/ultima/ultima8/usecode/uc_stack.h
+++ b/test/engines/ultima/ultima8/usecode/uc_stack.h
@@ -17,25 +17,25 @@ class U8UCStackTestSuite : public CxxTest::TestSuite {
 	void test_dynamic_stack() {
 		Ultima::Ultima8::DynamicUCStack stack;
 		Ultima::Ultima8::DynamicUCStack stack2(32);
-		TS_ASSERT_EQUALS(stack2.getSize(), 32);
+		TS_ASSERT_EQUALS(stack2.getSize(), 32u);
 		test_for_stack(stack);
 		test_for_stack(stack2);
 	}
 
 	private:
 	void test_for_stack(Ultima::Ultima8::BaseUCStack &s) {
-		TS_ASSERT_EQUALS(s.stacksize(), 0);
+		TS_ASSERT_EQUALS(s.stacksize(), 0u);
 		s.push4(0xDEADBEEF);
-		TS_ASSERT_EQUALS(s.stacksize(), 4);
-		TS_ASSERT_EQUALS(s.pop2(), 0xBEEF);
-		TS_ASSERT_EQUALS(s.pop2(), 0xDEAD);
+		TS_ASSERT_EQUALS(s.stacksize(), 4u);
+		TS_ASSERT_EQUALS(s.pop2(), 0xBEEFu);
+		TS_ASSERT_EQUALS(s.pop2(), 0xDEADu);
 		s.push1(0xFE);
-		TS_ASSERT_EQUALS(s.stacksize(), 1);
+		TS_ASSERT_EQUALS(s.stacksize(), 1u);
 		s.push1(0xED);
 		s.push2(0xC0DE);
-		TS_ASSERT_EQUALS(s.pop2(), 0xC0DE);
-		TS_ASSERT_EQUALS(s.pop2(), 0xFEED);
-		TS_ASSERT_EQUALS(s.stacksize(), 0);
+		TS_ASSERT_EQUALS(s.pop2(), 0xC0DEu);
+		TS_ASSERT_EQUALS(s.pop2(), 0xFEEDu);
+		TS_ASSERT_EQUALS(s.stacksize(), 0u);
 		TS_ASSERT_EQUALS(s.getSP(), s.getSize());
 		s.push4(0xCAFEF00D);
 		TS_ASSERT_EQUALS(s.getSP(), s.getSize()-4);


Commit: d89fe6c53f99fcc4482c79f633fb7aae28f97474
    https://github.com/scummvm/scummvm/commit/d89fe6c53f99fcc4482c79f633fb7aae28f97474
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2026-02-07T17:20:49+01:00

Commit Message:
TEST: Allow to build tests with ASan

Changed paths:
    test/system/null_osystem.cpp


diff --git a/test/system/null_osystem.cpp b/test/system/null_osystem.cpp
index 072e7a9e35b..4c9a9645c46 100644
--- a/test/system/null_osystem.cpp
+++ b/test/system/null_osystem.cpp
@@ -4,6 +4,7 @@
 #define NULL_DRIVER_USE_FOR_TEST 1
 #include "null_osystem.h"
 #include "../backends/platform/null/null.cpp"
+#include "../backends/saves/savefile.cpp"
 
 //#define DISPLAY_ERROR_MESSAGES
 


Commit: 3fd6465203d1ff9bbc1549929131a510cccc5d20
    https://github.com/scummvm/scummvm/commit/3fd6465203d1ff9bbc1549929131a510cccc5d20
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2026-02-07T17:20:49+01:00

Commit Message:
TEST: Fix memory leaks in tests using backend

Uninstall the backend after installing it.
Also start the backend to initialize date.
Don't try to initialize the CD manager.

Changed paths:
    backends/platform/null/null.cpp
    test/common/encoding.h
    test/image/blending.h
    test/system/null_osystem.cpp
    test/system/null_osystem.h


diff --git a/backends/platform/null/null.cpp b/backends/platform/null/null.cpp
index f3f1e4bb55a..e1eddd727b3 100644
--- a/backends/platform/null/null.cpp
+++ b/backends/platform/null/null.cpp
@@ -154,9 +154,9 @@ void OSystem_NULL::initBackend() {
 	_mixerManager = new NullMixerManager();
 	// Setup and start mixer
 	_mixerManager->init();
-#endif
 
 	BaseBackend::initBackend();
+#endif
 }
 
 bool OSystem_NULL::pollEvent(Common::Event &event) {
diff --git a/test/common/encoding.h b/test/common/encoding.h
index 15a5a16b0e1..8069bf3749e 100644
--- a/test/common/encoding.h
+++ b/test/common/encoding.h
@@ -15,9 +15,20 @@
 class EncodingTestSuite : public CxxTest::TestSuite
 {
 public:
-	void test_korean() {
+	void setUp() {
 #if TEST_CJK
 		Common::install_null_g_system();
+#endif
+	}
+
+	void tearDown() {
+#if TEST_CJK
+		Common::uninstall_null_g_system();
+#endif
+	}
+
+	void test_korean() {
+#if TEST_CJK
 		const byte utf8[] = {
 			0xea, 0xb2, 0x8c, 0xec, 0x9e, 0x84, 0xec, 0xa4,
 			0x91, 0xec, 0xa7, 0x80, 0x20, 0xea, 0xb3, 0x84,
@@ -58,7 +69,6 @@ public:
 
 	void test_chinese() {
 #if TEST_CJK
-		Common::install_null_g_system();
 		const byte utf8[] = {
 			0xe9, 0x81, 0x8a, 0xe6, 0x88, 0xb2, 0xe6, 0x9a,
 			0xab, 0xe5, 0x81, 0x9c, 0xe3, 0x80, 0x82, 0xe6,
@@ -94,7 +104,6 @@ public:
 
 	void test_japanese() {
 #if TEST_CJK
-		Common::install_null_g_system();
 		const byte utf8[] = {
 			0xe4, 0xb8, 0x80, 0xe6, 0x99, 0x82, 0xe5, 0x81,
 			0x9c, 0xe6, 0xad, 0xa2, 0xe3, 0x80, 0x82, 0xe7,
diff --git a/test/image/blending.h b/test/image/blending.h
index 5daa2e3f40f..0850857d358 100644
--- a/test/image/blending.h
+++ b/test/image/blending.h
@@ -796,10 +796,20 @@ static bool areSurfacesEqual(const Graphics::ManagedSurface *a, const Graphics::
 
 class BlendBlitUnfilteredTestSuite : public CxxTest::TestSuite {
 public:
-	void test_blend_speed() {
+	void setUp() {
 #if BENCHMARK_TIME
 		Common::install_null_g_system();
+#endif
+	}
 
+	void tearDown() {
+#if BENCHMARK_TIME
+		Common::uninstall_null_g_system();
+#endif
+	}
+
+	void test_blend_speed() {
+#if BENCHMARK_TIME
 		Graphics::BlendBlit::blitFunc = Graphics::BlendBlit::blitGeneric;
 #ifdef SCUMMVM_NEON
 		Graphics::BlendBlit::blitFunc = Graphics::BlendBlit::blitNEON;
diff --git a/test/system/null_osystem.cpp b/test/system/null_osystem.cpp
index 4c9a9645c46..990df846e61 100644
--- a/test/system/null_osystem.cpp
+++ b/test/system/null_osystem.cpp
@@ -16,6 +16,12 @@ void Common::install_null_g_system() {
 #endif
 
 	g_system = OSystem_NULL_create(silenceLogs);
+	g_system->initBackend();
+}
+
+void Common::uninstall_null_g_system() {
+	g_system->destroy();
+	g_system = nullptr;
 }
 
 void OSystem_NULL::quit() {
diff --git a/test/system/null_osystem.h b/test/system/null_osystem.h
index 1f99c7801f9..1d7be9a3519 100644
--- a/test/system/null_osystem.h
+++ b/test/system/null_osystem.h
@@ -3,6 +3,7 @@
 namespace Common {
 #if defined(POSIX) || defined(WIN32)
 void install_null_g_system();
+void uninstall_null_g_system();
 #define NULL_OSYSTEM_IS_AVAILABLE 1
 #else
 #define NULL_OSYSTEM_IS_AVAILABLE 0


Commit: 3017d16756dfc01933856a7e943f0c6122b9dd2d
    https://github.com/scummvm/scummvm/commit/3017d16756dfc01933856a7e943f0c6122b9dd2d
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2026-02-07T17:20:49+01:00

Commit Message:
COMMON: Fix ubsan errors

Shifting on signed values can be undefined and the data is not signed
anyway.

Changed paths:
    common/base64.cpp


diff --git a/common/base64.cpp b/common/base64.cpp
index c17a3c9e00d..627e92f2871 100644
--- a/common/base64.cpp
+++ b/common/base64.cpp
@@ -63,7 +63,8 @@ bool b64Validate(String &string) {
 
 String b64EncodeString(String &string) {
 	String out;
-	int32 val = 0, valb = -6;
+	uint32 val = 0;
+	int32 valb = -6;
 	for (uint8 c : string) {
 		val = (val << 8) + c;
 		valb += 8;
@@ -81,7 +82,8 @@ String b64EncodeString(String &string) {
 
 String b64EncodeStream(ReadStream &stream) {
 	String out;
-	int32 val = 0, valb = -6;
+	uint32 val = 0;
+	int32 valb = -6;
 	while (true) {
 		uint8 b = stream.readByte();
 		if (stream.eos())
@@ -102,7 +104,8 @@ String b64EncodeStream(ReadStream &stream) {
 
 String b64EncodeData(void *dataPtr, size_t dataSize) {
 	String out;
-	int32 val = 0, valb = -6;
+	uint32 val = 0;
+	int32 valb = -6;
 	uint8 *p = (uint8 *)dataPtr;
 
 	for (size_t i = 0; i < dataSize; i++) {
@@ -133,7 +136,8 @@ String b64DecodeString(String &string) {
 		T[encodingTable[i]] = i;
 	}
 
-	int val = 0, valb = -8;
+	uint32 val = 0;
+	int32 valb = -8;
 	for (char c : string) {
 		if (T[c] == -1)
 			break;
@@ -162,7 +166,8 @@ MemoryReadStream *b64DecodeStream(String &string, uint32 outputLength) {
 		T[encodingTable[i]] = i;
 	}
 
-	int val = 0, valb = -8, valc = 0;
+	uint32 val = 0, valc = 0;
+	int32 valb = -8;
 	for (char c : string) {
 		if (T[c] == -1)
 			break;
@@ -188,7 +193,8 @@ bool b64DecodeData(String &string, void *dataPtr) {
 		T[encodingTable[i]] = i;
 	}
 
-	int val = 0, valb = -8, valc = 0;
+	uint32 val = 0, valc = 0;
+	int32 valb = -8;
 	for (char c : string) {
 		if (T[c] == -1)
 			break;


Commit: 39a77b92943186bd6ee8cec1ca7afbeae5aee03b
    https://github.com/scummvm/scummvm/commit/39a77b92943186bd6ee8cec1ca7afbeae5aee03b
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2026-02-07T17:20:49+01:00

Commit Message:
TEST: Fix UB when shifting sample

Changed paths:
    test/audio/helper.h


diff --git a/test/audio/helper.h b/test/audio/helper.h
index 77dc63b619d..73bc45c1863 100644
--- a/test/audio/helper.h
+++ b/test/audio/helper.h
@@ -40,7 +40,7 @@ static Audio::SeekableAudioStream *createSineStream(const int sampleRate, const
 			if (is16Bits)
 				(*comp)[i] = sine[i] ^ xorMask;
 			else
-				(*comp)[i] = (sine[i] ^ xorMask) << 8;
+				(*comp)[i] = (sine[i] ^ xorMask) * 256;
 		}
 	}
 




More information about the Scummvm-git-logs mailing list