Commit 45d4aa9f authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

mfplat/mediatype: Check format pointers and sizes in MFInitMediaTypeFromAMMediaType.

parent 9ee0720d
......@@ -4270,13 +4270,17 @@ HRESULT WINAPI MFInitMediaTypeFromAMMediaType(IMFMediaType *media_type, const AM
{
const GUID *subtype = get_mf_subtype_for_am_subtype(&am_type->subtype);
if (IsEqualGUID(&am_type->formattype, &FORMAT_VideoInfo))
if (am_type->cbFormat && !am_type->pbFormat)
hr = E_INVALIDARG;
else if (IsEqualGUID(&am_type->formattype, &FORMAT_VideoInfo)
&& am_type->cbFormat >= sizeof(VIDEOINFOHEADER))
hr = MFInitMediaTypeFromVideoInfoHeader(media_type, (VIDEOINFOHEADER *)am_type->pbFormat, am_type->cbFormat, subtype);
else if (IsEqualGUID(&am_type->formattype, &FORMAT_VideoInfo2))
else if (IsEqualGUID(&am_type->formattype, &FORMAT_VideoInfo2)
&& am_type->cbFormat >= sizeof(VIDEOINFOHEADER2))
hr = MFInitMediaTypeFromVideoInfoHeader2(media_type, (VIDEOINFOHEADER2 *)am_type->pbFormat, am_type->cbFormat, subtype);
else
{
FIXME("Unsupported format type %s.\n", debugstr_guid(&am_type->formattype));
FIXME("Unsupported format type %s / size %ld.\n", debugstr_guid(&am_type->formattype), am_type->cbFormat);
return E_NOTIMPL;
}
......
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