Bug 341077

Summary: FLAC plugin's function seekToFrame may not work properly
Product: [Applications] k3b Reporter: Vitaliy <vitfunk>
Component: PluginsAssignee: k3b developers <k3b>
Status: RESOLVED FIXED    
Severity: normal CC: aacid, michalm, trueg
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: All   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Vitaliy 2014-11-18 11:33:11 UTC
Multiply in the function seekToFrame may cause loss of data:
bool K3bFLACDecoder::Private::seekToFrame(int frame) {
    FLAC__uint64 sample = frame * rate / 75;
    return seek_absolute(sample);
}

Correct function:
bool K3bFLACDecoder::Private::seekToFrame(int frame) {
    FLAC__uint64 sample = static_cast<FLAC__uint64>(frame) * rate / 75;
    return seek_absolute(sample);
}

Reproducible: Sometimes

Steps to Reproduce:
1. Take the CD-Rip FLAC with CUE-sheet
2. Leave one random track from cd, remove other
3. Burn CD or make an image
4. Content of the track will different from the selected
Comment 1 Albert Astals Cid 2014-11-18 19:10:11 UTC
What's the problem, is it overflowing?
Comment 2 Vitaliy 2014-11-19 14:06:42 UTC
Yes, it is.
Comment 3 Albert Astals Cid 2014-11-19 21:51:58 UTC
Git commit ef2ce428dc1607563273d1258f56d9083dcf99d4 by Albert Astals Cid.
Committed on 19/11/2014 at 21:50.
Pushed by aacid into branch '2.0'.

FLAC plugin's function seekToFrame may not work properly

Patch by Vitaly <vitfunk@yandex.ru>

M  +1    -1    plugins/decoder/flac/k3bflacdecoder.cpp

http://commits.kde.org/k3b/ef2ce428dc1607563273d1258f56d9083dcf99d4