[Scummvm-git-logs] scummvm master -> 26aee4e81f9c6cccfde4b7b7525443b0ea156591
bluegr
noreply at scummvm.org
Wed Jun 10 09:35:52 UTC 2026
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
9192240e43 MOHAWK: Sound - Fix out of bounds seek crash.
26aee4e81f MOHAWK: LB - Increase sensitivity.
Commit: 9192240e43d437688f72df42197a78a50e2c3844
https://github.com/scummvm/scummvm/commit/9192240e43d437688f72df42197a78a50e2c3844
Author: Alstruit (34786806+Alstruit at users.noreply.github.com)
Date: 2026-06-10T12:35:48+03:00
Commit Message:
MOHAWK: Sound - Fix out of bounds seek crash.
Some Mohawk sound files may report the chunk size greater than the actual chunk size probed.
Example: "Arthur's Computer Adventure".
Fixes Assertion `_pos <= _end' failed error.
Changed paths:
engines/mohawk/sound.cpp
diff --git a/engines/mohawk/sound.cpp b/engines/mohawk/sound.cpp
index 8c104e0e17b..39f1f84de0d 100644
--- a/engines/mohawk/sound.cpp
+++ b/engines/mohawk/sound.cpp
@@ -47,6 +47,20 @@ namespace Mohawk {
* @param stream The stream to look for samples.
*/
void scanAndFixAudioPops(DataChunk &dataChunk, uint32 &dataSize, Common::SeekableReadStream *stream) {
+
+ // Some assets declare more DATA payload bytes than remain in the current stream.
+ // Clamp dataSize to the bytes physically available before probing the final samples.
+ if (stream->size() != -1) {
+ int64 availableBytes = stream->size() - stream->pos();
+ if (availableBytes >= 0 && dataSize > (uint32)availableBytes) {
+ debug(1, "MOHAWK: Clamping declared dataSize %u to actual available bytes %u", dataSize, (uint32)availableBytes);
+ dataSize = (uint32)availableBytes;
+ }
+ }
+
+ if (dataSize < 4)
+ return;
+
const int PCM8_U_SILENCE = 0x80;
const int SQUELCH = 32; // Threshold of discontinuity before removing. Lower values = increased sensitivity.
bool is_safe = false;
@@ -325,6 +339,14 @@ Audio::RewindableAudioStream *Sound::makeLivingBooksWaveStream_v1(Common::Seekab
} else
error("Could not find Old Mohawk Sound header");
+ if (size >= 4 && ConfMan.getBool("fix_audio_pops")) {
+ DataChunk chunk;
+ memset(&chunk, 0, sizeof(DataChunk));
+ chunk.sampleCount = size;
+
+ scanAndFixAudioPops(chunk, size, stream);
+ }
+
Common::SeekableReadStream *dataStream = stream->readStream(size);
delete stream;
Commit: 26aee4e81f9c6cccfde4b7b7525443b0ea156591
https://github.com/scummvm/scummvm/commit/26aee4e81f9c6cccfde4b7b7525443b0ea156591
Author: Alstruit (34786806+Alstruit at users.noreply.github.com)
Date: 2026-06-10T12:35:48+03:00
Commit Message:
MOHAWK: LB - Increase sensitivity.
A value of a distance of 8 units is enough to trigger a pop.
Found in "bearfight" on page 2. First pop is small but still perceptible.
Changed paths:
engines/mohawk/sound.cpp
diff --git a/engines/mohawk/sound.cpp b/engines/mohawk/sound.cpp
index 39f1f84de0d..f87c3612b57 100644
--- a/engines/mohawk/sound.cpp
+++ b/engines/mohawk/sound.cpp
@@ -62,7 +62,7 @@ void scanAndFixAudioPops(DataChunk &dataChunk, uint32 &dataSize, Common::Seekabl
return;
const int PCM8_U_SILENCE = 0x80;
- const int SQUELCH = 32; // Threshold of discontinuity before removing. Lower values = increased sensitivity.
+ const int SQUELCH = 8; // Threshold of discontinuity before removing. Lower values = increased sensitivity.
bool is_safe = false;
// Peek at the last 4 samples without permanently moving the stream pointer.
@@ -76,7 +76,7 @@ void scanAndFixAudioPops(DataChunk &dataChunk, uint32 &dataSize, Common::Seekabl
// any minor fluctuation is inaudible and the sound is considered safe.
bool is_stable_and_quiet = true;
for (int i = 0; i < 4; i++) {
- if (abs(s[i] - PCM8_U_SILENCE) > SQUELCH) {
+ if (abs(s[i] - PCM8_U_SILENCE) >= SQUELCH) {
is_stable_and_quiet = false;
break;
}
More information about the Scummvm-git-logs
mailing list