From 82ae8daccfd3684f277e0ea2e22e8a4288694d47 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Thu, 22 Feb 2007 18:33:01 +0000 Subject: [PATCH] Reduce chance for overflows in VorbisTrackInfo::play svn-id: r25793 --- sound/vorbis.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sound/vorbis.cpp b/sound/vorbis.cpp index 283050fff26..898730909a7 100644 --- a/sound/vorbis.cpp +++ b/sound/vorbis.cpp @@ -341,9 +341,10 @@ void VorbisTrackInfo::play(Audio::Mixer *mixer, Audio::SoundHandle *handle, int return; } - // Convert startFrame & duration from frames (1/75 s) to milliseconds (1/1000s) - uint start = startFrame * 1000 / 75; - uint end = duration ? ((startFrame + duration) * 1000 / 75) : 0; + // Convert startFrame & duration from frames (1/75 s) to milliseconds (1/1000s), + // i.e. multiple with a factor of 1000/75 = 40/3 + uint start = startFrame * 40 / 3; + uint end = duration ? ((startFrame + duration) * 40 / 3) : 0; // ... create an AudioStream ... VorbisInputStream *input = new VorbisInputStream(file, true, start, end);