mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-05 18:01:34 +00:00
qcap: Validate the index in AMStreamConfig_GetStreamCaps().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
fa0ff00e57
commit
d00c6af248
3 changed files with 10 additions and 20 deletions
|
@ -48,7 +48,7 @@ struct video_capture_funcs
|
|||
HRESULT (*set_format)(struct video_capture_device *device, const AM_MEDIA_TYPE *mt);
|
||||
HRESULT (*get_format)(struct video_capture_device *device, AM_MEDIA_TYPE *mt);
|
||||
HRESULT (*get_media_type)(struct video_capture_device *device, unsigned int index, AM_MEDIA_TYPE *mt);
|
||||
HRESULT (*get_caps)(struct video_capture_device *device, LONG index, AM_MEDIA_TYPE *mt,
|
||||
void (*get_caps)(struct video_capture_device *device, LONG index, AM_MEDIA_TYPE *mt,
|
||||
VIDEOINFOHEADER *format, VIDEO_STREAM_CONFIG_CAPS *caps);
|
||||
LONG (*get_caps_count)(struct video_capture_device *device);
|
||||
HRESULT (*get_prop_range)(struct video_capture_device *device, VideoProcAmpProperty property,
|
||||
|
|
|
@ -373,16 +373,12 @@ static void fill_caps(__u32 pixelformat, __u32 width, __u32 height,
|
|||
caps->pixelformat = pixelformat;
|
||||
}
|
||||
|
||||
static HRESULT v4l_device_get_caps(struct video_capture_device *device, LONG index,
|
||||
static void v4l_device_get_caps(struct video_capture_device *device, LONG index,
|
||||
AM_MEDIA_TYPE *type, VIDEOINFOHEADER *format, VIDEO_STREAM_CONFIG_CAPS *vscc)
|
||||
{
|
||||
if (index >= device->caps_count)
|
||||
return S_FALSE;
|
||||
|
||||
*vscc = device->caps[index].config;
|
||||
*type = device->caps[index].media_type;
|
||||
*format = device->caps[index].video_info;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static LONG v4l_device_get_caps_count(struct video_capture_device *device)
|
||||
|
|
|
@ -377,10 +377,12 @@ static HRESULT WINAPI AMStreamConfig_GetStreamCaps(IAMStreamConfig *iface,
|
|||
struct vfw_capture *filter = impl_from_IAMStreamConfig(iface);
|
||||
VIDEOINFOHEADER *format;
|
||||
AM_MEDIA_TYPE *mt;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("filter %p, index %d, pmt %p, vscc %p.\n", filter, index, pmt, vscc);
|
||||
|
||||
if (index > capture_funcs->get_caps_count(filter->device))
|
||||
return S_FALSE;
|
||||
|
||||
if (!(mt = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE))))
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
|
@ -390,19 +392,11 @@ static HRESULT WINAPI AMStreamConfig_GetStreamCaps(IAMStreamConfig *iface,
|
|||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
if ((hr = capture_funcs->get_caps(filter->device, index, mt,
|
||||
format, (VIDEO_STREAM_CONFIG_CAPS *)vscc)) == S_OK)
|
||||
{
|
||||
mt->cbFormat = sizeof(VIDEOINFOHEADER);
|
||||
mt->pbFormat = (BYTE *)format;
|
||||
*pmt = mt;
|
||||
}
|
||||
else
|
||||
{
|
||||
CoTaskMemFree(format);
|
||||
CoTaskMemFree(mt);
|
||||
}
|
||||
return hr;
|
||||
capture_funcs->get_caps(filter->device, index, mt, format, (VIDEO_STREAM_CONFIG_CAPS *)vscc);
|
||||
mt->cbFormat = sizeof(VIDEOINFOHEADER);
|
||||
mt->pbFormat = (BYTE *)format;
|
||||
*pmt = mt;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static const IAMStreamConfigVtbl IAMStreamConfig_VTable =
|
||||
|
|
Loading…
Reference in a new issue