mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-04 18:06:26 +00:00
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.
This commit is contained in:
parent
4a76e6fb3d
commit
e6228f3ff6
@ -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>
|
||||
|
Loading…
x
Reference in New Issue
Block a user