[Scummvm-cvs-logs] scummvm master -> 2eecbe68fa9f1ba80e7c78fd578e4b95577e7d3a

m-kiewitz m_kiewitz at users.sourceforge.net
Wed Jan 27 21:19:20 CET 2016


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

Summary:
2eecbe68fa AGI: Apple IIgs: remove warning about bad sample size


Commit: 2eecbe68fa9f1ba80e7c78fd578e4b95577e7d3a
    https://github.com/scummvm/scummvm/commit/2eecbe68fa9f1ba80e7c78fd578e4b95577e7d3a
Author: Martin Kiewitz (m_kiewitz at users.sourceforge.net)
Date: 2016-01-27T21:18:45+01:00

Commit Message:
AGI: Apple IIgs: remove warning about bad sample size

Changed paths:
    engines/agi/sound_2gs.cpp



diff --git a/engines/agi/sound_2gs.cpp b/engines/agi/sound_2gs.cpp
index 6495d22..176ac56 100644
--- a/engines/agi/sound_2gs.cpp
+++ b/engines/agi/sound_2gs.cpp
@@ -577,17 +577,16 @@ bool IIgsInstrumentHeader::finalize(int8 *wavetable, uint32 wavetableSize) {
 			}
 
 			if ((waveOffset + waveSize) > wavetableSize) {
-				// size seems to be incorrect
-				// actually happens for at least Manhunter 1, when looking at corpse at the start
-				warning("Apple IIgs sound: sample exceeds size of wavetable. sample got cut");
+				// fix up size, it's actually saved in a way in the header, that it can't be correct
+				// if we don't fix it here, we would do invalid memory access, which results in potential crashes
 				wave[i][k].size = wavetableSize - waveOffset;
 			}
 
-			// Detect true sample size in case the sample ends prematurely.
-			int8 *p = wavetableBase + wave[i][k].offset;
+			// Detect true sample size
+			int8 *sample = wavetableBase + wave[i][k].offset;
 			uint32 trueSize;
 			for (trueSize = 0; trueSize < wave[i][k].size; trueSize++) {
-				if (p[trueSize] == -ZERO_OFFSET)
+				if (sample[trueSize] == -ZERO_OFFSET)
 					break;
 			}
 			wave[i][k].size = trueSize;






More information about the Scummvm-git-logs mailing list