Module: wine Branch: master Commit: 0d263f9fdaac21e51844376da5cfa054ee7fc520 URL: https://source.winehq.org/git/wine.git/?a=commit;h=0d263f9fdaac21e51844376da...
Author: Ziqing Hui zhui@codeweavers.com Date: Mon Jun 1 12:58:52 2020 +0800
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
---
dlls/windowscodecs/ddsformat.c | 2 ++ dlls/windowscodecs/tests/ddsformat.c | 6 ++++++ 2 files changed, 8 insertions(+)
diff --git a/dlls/windowscodecs/ddsformat.c b/dlls/windowscodecs/ddsformat.c index 20017788a0..9446c7e8e6 100644 --- a/dlls/windowscodecs/ddsformat.c +++ b/dlls/windowscodecs/ddsformat.c @@ -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;
diff --git a/dlls/windowscodecs/tests/ddsformat.c b/dlls/windowscodecs/tests/ddsformat.c index c7f56307d7..be7bb0a0e6 100644 --- a/dlls/windowscodecs/tests/ddsformat.c +++ b/dlls/windowscodecs/tests/ddsformat.c @@ -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;