Commit 6fd90f16 authored by Maarten Lankhorst's avatar Maarten Lankhorst Committed by Alexandre Julliard

quartz: Small mpeg splitter fixes.

Just to be cautious, since it reads 4 bytes it should stop trying at EOF-3. Also be more strict with the return values.
parent 0faee4af
...@@ -651,16 +651,18 @@ static HRESULT MPEGSplitter_pre_connect(IPin *iface, IPin *pConnectPin) ...@@ -651,16 +651,18 @@ static HRESULT MPEGSplitter_pre_connect(IPin *iface, IPin *pConnectPin)
This->EndOfFile -= 128; This->EndOfFile -= 128;
/* http://mpgedit.org/mpgedit/mpeg_format/mpeghdr.htm has a whole readup on audio headers */ /* 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; LONGLONG length = 0;
hr = IAsyncReader_SyncRead(pPin->pReader, pos, 4, header); hr = IAsyncReader_SyncRead(pPin->pReader, pos, 4, header);
if (hr != S_OK)
break;
while (parse_header(header, &length, &duration)) while (parse_header(header, &length, &duration))
{ {
/* No valid header yet; shift by a byte and check again */ /* No valid header yet; shift by a byte and check again */
memmove(header, header+1, 3); memmove(header, header+1, 3);
hr = IAsyncReader_SyncRead(pPin->pReader, pos++, 1, header + 3); hr = IAsyncReader_SyncRead(pPin->pReader, pos++, 1, header + 3);
if (FAILED(hr)) if (hr != S_OK || This->EndOfFile - pos < 4)
break; break;
} }
pos += length; pos += length;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment