[Scummvm-git-logs] scummvm master -> a494de21d44bcdbaece5c80e38d7596f2ebe8c7e
bluegr
noreply at scummvm.org
Fri Sep 25 01:41:22 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:
a494de21d4 MACVENTURE: fix assertion failure when decoding huffman data
Commit: a494de21d44bcdbaece5c80e38d7596f2ebe8c7e
https://github.com/scummvm/scummvm/commit/a494de21d44bcdbaece5c80e38d7596f2ebe8c7e
Author: vorph999 (vorph at gmx.net)
Date: 2026-09-25T04:41:19+03:00
Commit Message:
MACVENTURE: fix assertion failure when decoding huffman data
The mask array is not fully initialized, leaving the last entry empty on purpose. By setting a valid entry (max value) on initialization - we avoid random values.
Changed paths:
engines/macventure/macventure.cpp
diff --git a/engines/macventure/macventure.cpp b/engines/macventure/macventure.cpp
index 2d492a1ee14..1043279b803 100644
--- a/engines/macventure/macventure.cpp
+++ b/engines/macventure/macventure.cpp
@@ -1367,6 +1367,14 @@ bool MacVentureEngine::loadTextHuffman() {
// For some reason there are one lass mask than entries
masks[i] = res->readUint16BE();
}
+ // make sure array is fully initialized
+ masks[numEntries - 1] = 0x10000;
+ // by setting the 'last' enttry to 0x10000 (max 16 bit integer + 1) we make sure that the
+ // iteration in TextAsset::decodeHuffmann never fails. This iteration will search for a
+ // 16 bit value < mask[i]. If array is not properly set up, we either get a random value for
+ // mask[numEntries - 1] (0 on optimized code). Depending on value, NO entry is found in
+ // huffman table resulting in an out of bounds index. That will ultimately result in assert
+ // failure when accessing an element in _textHuffman.
uint32 *lengths = new uint32[numEntries];
for (uint i = 0; i < numEntries; i++) {
More information about the Scummvm-git-logs
mailing list