Bug 341077 - FLAC plugin's function seekToFrame may not work properly
Summary: FLAC plugin's function seekToFrame may not work properly
Status: RESOLVED FIXED
Alias: None
Product: k3b
Classification: Applications
Component: Plugins (show other bugs)
Version: unspecified
Platform: unspecified All
: NOR normal
Target Milestone: ---
Assignee: k3b developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-18 11:33 UTC by Vitaliy
Modified: 2014-11-19 21:51 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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