Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/mpc-hc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorv0lt <v0lt@users.sourceforge.net>2011-07-03 15:21:50 +0400
committerv0lt <v0lt@users.sourceforge.net>2011-07-03 15:21:50 +0400
commit108655c7c8b268cb51c72809aa8d0bb0c34dfca2 (patch)
tree729ffe295a10ec3ad6153bc9926538c8d9ed447c /src/filters/parser/AviSplitter
parent1d19859ec50a70965d2d41d7553d7304f037a797 (diff)
AviSplitter: fixed r3305 (arithmetic overflow)
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@3310 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/filters/parser/AviSplitter')
-rw-r--r--src/filters/parser/AviSplitter/AviFile.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/filters/parser/AviSplitter/AviFile.cpp b/src/filters/parser/AviSplitter/AviFile.cpp
index 82512952d..6fcd48344 100644
--- a/src/filters/parser/AviSplitter/AviFile.cpp
+++ b/src/filters/parser/AviSplitter/AviFile.cpp
@@ -565,14 +565,14 @@ REFERENCE_TIME CAviFile::strm_t::GetRefTime(DWORD frame, UINT64 size)
int CAviFile::strm_t::GetFrame(REFERENCE_TIME rt)
{
- int frame = -1;
+ int frame;
- float rate_per_scale = strh.dwScale ? 1.0f * strh.dwRate / strh.dwScale : 0;
-
- if(strh.fccType == FCC('auds')) {
+ if (strh.dwScale == 0) {
+ frame = 0;
+ } else if (strh.fccType == FCC('auds')) {
WAVEFORMATEX* wfe = (WAVEFORMATEX*)strf.GetData();
- __int64 size = (__int64)(rate_per_scale * wfe->nBlockAlign * rt / 10000000 + 0.5f);
+ __int64 size = (__int64)(rt * wfe->nBlockAlign * strh.dwRate / (strh.dwScale * 10000000i64));
for(frame = 0; frame < cs.GetCount(); frame++) {
if(cs[frame].size > size) {
@@ -581,7 +581,7 @@ int CAviFile::strm_t::GetFrame(REFERENCE_TIME rt)
}
}
} else {
- frame = (int)(rate_per_scale * rt / 10000000 + 0.5f);
+ frame = (int)(rt * strh.dwRate / (strh.dwScale * 10000000i64));
}
if(frame >= cs.GetCount()) {