mfreadwrite/reader: Avoid accessing an invalid stream index.

Fixes d6c9ac94d2.
This commit is contained in:
Rémi Bernon 2024-03-27 11:02:24 +01:00 committed by Alexandre Julliard
parent 5cd5e7b8c6
commit e3510c6bdb

View file

@ -2365,7 +2365,6 @@ static HRESULT WINAPI src_reader_GetServiceForStream(IMFSourceReaderEx *iface, D
REFIID riid, void **object)
{
struct source_reader *reader = impl_from_IMFSourceReaderEx(iface);
struct media_stream *stream = &reader->streams[index];
IUnknown *obj = NULL;
HRESULT hr = S_OK;
@ -2386,7 +2385,7 @@ static HRESULT WINAPI src_reader_GetServiceForStream(IMFSourceReaderEx *iface, D
if (index >= reader->stream_count)
hr = MF_E_INVALIDSTREAMNUMBER;
else if (!(obj = (IUnknown *)stream->transform_service))
else if (!(obj = (IUnknown *)reader->streams[index].transform_service))
hr = E_NOINTERFACE;
break;
}