windowscodecs: Check NULL parameters for DdsFrameDecode_GetSize().

Signed-off-by: Ziqing Hui <zhui@codeweavers.com>
Signed-off-by: Esme Povirk <vincent@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Ziqing Hui 2020-06-01 12:58:52 +08:00 committed by Alexandre Julliard
parent a1222a3595
commit 0d263f9fda
2 changed files with 8 additions and 0 deletions

View File

@ -301,6 +301,8 @@ static HRESULT WINAPI DdsFrameDecode_GetSize(IWICBitmapFrameDecode *iface,
{
DdsFrameDecode *This = impl_from_IWICBitmapFrameDecode(iface);
if (!puiWidth || !puiHeight) return E_INVALIDARG;
*puiWidth = This->width;
*puiHeight = This->height;

View File

@ -382,6 +382,12 @@ static void test_dds_decoder_frame_size(IWICBitmapDecoder *decoder, IWICBitmapFr
ok (hr == S_OK, "%d: GetParameters failed, hr=%x\n", i, hr);
if (hr != S_OK) goto end;
hr = IWICBitmapFrameDecode_GetSize(frame_decode, NULL, NULL);
ok (hr == E_INVALIDARG, "%d: [frame %d] Got unexpected hr %x\n", i, frame_index, hr);
hr = IWICBitmapFrameDecode_GetSize(frame_decode, NULL, &height);
ok (hr == E_INVALIDARG, "%d: [frame %d] Got unexpected hr %x\n", i, frame_index, hr);
hr = IWICBitmapFrameDecode_GetSize(frame_decode, &width, NULL);
ok (hr == E_INVALIDARG, "%d: [frame %d] Got unexpected hr %x\n", i, frame_index, hr);
hr = IWICBitmapFrameDecode_GetSize(frame_decode, &width, &height);
ok (hr == S_OK, "%d: GetSize failed for frame %d, hr=%x\n", i, frame_index, hr);
if (hr != S_OK) goto end;