Module: wine Branch: master Commit: 45d4aa9f606e6c41ea78e10e205883bcc4e33a15 URL: https://gitlab.winehq.org/wine/wine/-/commit/45d4aa9f606e6c41ea78e10e205883b...
Author: Rémi Bernon rbernon@codeweavers.com Date: Tue Mar 12 19:58:36 2024 +0100
mfplat/mediatype: Check format pointers and sizes in MFInitMediaTypeFromAMMediaType.
---
dlls/mfplat/mediatype.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/dlls/mfplat/mediatype.c b/dlls/mfplat/mediatype.c index e07cc2339c1..d8f39678278 100644 --- a/dlls/mfplat/mediatype.c +++ b/dlls/mfplat/mediatype.c @@ -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; }