1
0
Fork 0
mirror of synced 2025-03-07 03:53:26 +01:00

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

This commit is contained in:
Paul Gofman 2023-09-18 20:28:15 -06:00 committed by Alexandre Julliard
parent 902133b008
commit bb95f8c2f6
2 changed files with 6 additions and 1 deletions

View file

@ -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;
}

View file

@ -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;