Commit bb95f8c2 authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

winegstreamer: Validate maximum channel count in _SetInputType in AAC decoder.

parent 902133b0
......@@ -2586,7 +2586,7 @@ static void test_aac_decoder_channels(const struct attribute_desc *input_type_de
ok(hr == S_OK, "got %#lx.\n", hr);
else
{
todo_wine ok(hr == MF_E_INVALIDMEDIATYPE, "got %#lx.\n", hr);
ok(hr == MF_E_INVALIDMEDIATYPE, "got %#lx.\n", hr);
winetest_pop_context();
continue;
}
......
......@@ -374,6 +374,7 @@ static HRESULT WINAPI transform_SetInputType(IMFTransform *iface, DWORD id, IMFM
{
struct aac_decoder *decoder = impl_from_IMFTransform(iface);
MF_ATTRIBUTE_TYPE item_type;
UINT32 channel_count;
GUID major, subtype;
HRESULT hr;
ULONG i;
......@@ -396,6 +397,10 @@ static HRESULT WINAPI transform_SetInputType(IMFTransform *iface, DWORD id, IMFM
if (i == ARRAY_SIZE(aac_decoder_input_types))
return MF_E_INVALIDMEDIATYPE;
if (SUCCEEDED(IMFMediaType_GetUINT32(type, &MF_MT_AUDIO_NUM_CHANNELS, &channel_count))
&& channel_count >= ARRAY_SIZE(default_channel_mask))
return MF_E_INVALIDMEDIATYPE;
if (FAILED(IMFMediaType_GetItemType(type, &MF_MT_AUDIO_SAMPLES_PER_SECOND, &item_type))
|| item_type != MF_ATTRIBUTE_UINT32)
return MF_E_INVALIDMEDIATYPE;
......
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