[Scummvm-git-logs] scummvm master -> e6228f3ff67795858c791bb949e138f50b5866c0

csnover csnover at users.noreply.github.com
Sun Nov 12 03:25:49 CET 2017


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:
e6228f3ff6 SCI32: Fix integer overflow calculating audio duration


Commit: e6228f3ff67795858c791bb949e138f50b5866c0
    https://github.com/scummvm/scummvm/commit/e6228f3ff67795858c791bb949e138f50b5866c0
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-11-11T20:18:17-06:00

Commit Message:
SCI32: Fix integer overflow calculating audio duration

Due to the need to calculate the audio duration with millisecond
precision from the file size, it is possible to overflow a 32-bit
integer in games with long background audio loops, like RAMA,
during the calculation of the duration.

It is also not necessary to give some framerate here, so eliminate
the unnecessary explicit Timestamp construction with the second
argument.

Changed paths:
    engines/sci/sound/decoders/sol.cpp


diff --git a/engines/sci/sound/decoders/sol.cpp b/engines/sci/sound/decoders/sol.cpp
index a6eb8a4..b468e5e 100644
--- a/engines/sci/sound/decoders/sol.cpp
+++ b/engines/sci/sound/decoders/sol.cpp
@@ -151,7 +151,7 @@ SOLStream<STEREO, S16BIT, OLDDPCM8>::SOLStream(Common::SeekableReadStream *strea
 		const uint8 compressionRatio = 2;
 		const uint8 numChannels = STEREO ? 2 : 1;
 		const uint8 bytesPerSample = S16BIT ? 2 : 1;
-		_length = Audio::Timestamp((_rawDataSize * compressionRatio * 1000) / (_sampleRate * numChannels * bytesPerSample), 60);
+		_length = ((uint64)_rawDataSize * compressionRatio * 1000) / (_sampleRate * numChannels * bytesPerSample);
 	}
 
 template <bool STEREO, bool S16BIT, bool OLDDPCM8>





More information about the Scummvm-git-logs mailing list