Commit 714e807a authored by Maarten Lankhorst's avatar Maarten Lankhorst Committed by Alexandre Julliard

quartz: Check against a null dereference and don't read beyond the end of file.

parent ae1791b0
...@@ -370,8 +370,12 @@ fail: ...@@ -370,8 +370,12 @@ fail:
FIXME("Failed with hres: %08x!\n", hr); FIXME("Failed with hres: %08x!\n", hr);
This->skipbytes += This->remaining_bytes; This->skipbytes += This->remaining_bytes;
This->remaining_bytes = 0; This->remaining_bytes = 0;
IMediaSample_Release(This->pCurrentSample); if (This->pCurrentSample)
This->pCurrentSample = NULL; {
IMediaSample_SetActualDataLength(This->pCurrentSample, 0);
IMediaSample_Release(This->pCurrentSample);
This->pCurrentSample = NULL;
}
} }
if (BYTES_FROM_MEDIATIME(tStop) >= This->EndOfFile) if (BYTES_FROM_MEDIATIME(tStop) >= This->EndOfFile)
...@@ -647,6 +651,7 @@ static HRESULT MPEGSplitter_pre_connect(IPin *iface, IPin *pConnectPin) ...@@ -647,6 +651,7 @@ static HRESULT MPEGSplitter_pre_connect(IPin *iface, IPin *pConnectPin)
while (pos < This->EndOfFile && SUCCEEDED(hr)) while (pos < This->EndOfFile && SUCCEEDED(hr))
{ {
LONGLONG length = 0; LONGLONG length = 0;
hr = IAsyncReader_SyncRead(pPin->pReader, pos, 4, header);
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 */
...@@ -655,11 +660,8 @@ static HRESULT MPEGSplitter_pre_connect(IPin *iface, IPin *pConnectPin) ...@@ -655,11 +660,8 @@ static HRESULT MPEGSplitter_pre_connect(IPin *iface, IPin *pConnectPin)
if (FAILED(hr)) if (FAILED(hr))
break; break;
} }
if (SUCCEEDED(hr)) pos += length;
{ TRACE("Pos: %x%08x/%x%08x\n", (DWORD)(pos >> 32), (DWORD)pos, (DWORD)(This->EndOfFile>>32), (DWORD)This->EndOfFile);
pos += length;
hr = IAsyncReader_SyncRead(pPin->pReader, pos, 4, header);
}
} }
hr = S_OK; hr = S_OK;
TRACE("Duration: %d seconds\n", (DWORD)(duration / 10000000)); TRACE("Duration: %d seconds\n", (DWORD)(duration / 10000000));
......
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