From f74c24fe1b180fed8b9028d2955b160f5eeea6b7 Mon Sep 17 00:00:00 2001 From: Maarten Lankhorst Date: Sun, 30 Mar 2008 21:18:49 -0700 Subject: [PATCH] quartz: Fix mpeg splitter --- dlls/quartz/mpegsplit.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dlls/quartz/mpegsplit.c b/dlls/quartz/mpegsplit.c index dca0042..0ecafc8 100644 --- a/dlls/quartz/mpegsplit.c +++ b/dlls/quartz/mpegsplit.c @@ -651,16 +651,18 @@ static HRESULT MPEGSplitter_pre_connect(IPin *iface, IPin *pConnectPin) This->EndOfFile -= 128; /* http://mpgedit.org/mpgedit/mpeg_format/mpeghdr.htm has a whole readup on audio headers */ - while (pos < This->EndOfFile && SUCCEEDED(hr)) + while (pos + 3 < This->EndOfFile) { LONGLONG length = 0; hr = IAsyncReader_SyncRead(pPin->pReader, pos, 4, header); + if (hr != S_OK) + break; while (parse_header(header, &length, &duration)) { /* No valid header yet; shift by a byte and check again */ memmove(header, header+1, 3); hr = IAsyncReader_SyncRead(pPin->pReader, pos++, 1, header + 3); - if (FAILED(hr)) + if (hr != S_OK || This->EndOfFile - pos < 4) break; } pos += length; -- 1.5.4.1