From a43657f68393dfedcef4f5dfa9fb2e17b114fc5b Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Tue, 15 Nov 2016 17:07:31 +0100 Subject: [PATCH] Added patch to set stream to NULL if AVIFileGetStream fails with an error. --- ...GetStream-should-set-stream-to-NULL-.patch | 42 +++++++++++++++++++ patches/avifil32-AVIFileGetStream/definition | 1 + patches/patchinstall.sh | 19 +++++++++ 3 files changed, 62 insertions(+) create mode 100644 patches/avifil32-AVIFileGetStream/0001-avifil32-AVIFileGetStream-should-set-stream-to-NULL-.patch create mode 100644 patches/avifil32-AVIFileGetStream/definition diff --git a/patches/avifil32-AVIFileGetStream/0001-avifil32-AVIFileGetStream-should-set-stream-to-NULL-.patch b/patches/avifil32-AVIFileGetStream/0001-avifil32-AVIFileGetStream-should-set-stream-to-NULL-.patch new file mode 100644 index 00000000..234dc55f --- /dev/null +++ b/patches/avifil32-AVIFileGetStream/0001-avifil32-AVIFileGetStream-should-set-stream-to-NULL-.patch @@ -0,0 +1,42 @@ +From 64ce8c391c3706a2b3ce9b5f8f76710d5751a766 Mon Sep 17 00:00:00 2001 +From: Dmitry Timoshkov +Date: Thu, 20 Oct 2016 17:48:24 +0800 +Subject: avifil32: AVIFileGetStream should set stream to NULL in case of an + error. + +--- + dlls/avifil32/avifile.c | 1 + + dlls/avifil32/tests/api.c | 5 +++++ + 2 files changed, 6 insertions(+) + +diff --git a/dlls/avifil32/avifile.c b/dlls/avifil32/avifile.c +index f649d05..7a4caaa 100644 +--- a/dlls/avifil32/avifile.c ++++ b/dlls/avifil32/avifile.c +@@ -316,6 +316,7 @@ static HRESULT WINAPI IAVIFile_fnGetStream(IAVIFile *iface, IAVIStream **avis, D + } + + /* Sorry, but the specified stream doesn't exist */ ++ *avis = NULL; + return AVIERR_NODATA; + } + +diff --git a/dlls/avifil32/tests/api.c b/dlls/avifil32/tests/api.c +index b3d822d..8a00865 100644 +--- a/dlls/avifil32/tests/api.c ++++ b/dlls/avifil32/tests/api.c +@@ -373,6 +373,11 @@ static void test_default_data(void) + res = AVIFileOpenA(&pFile, filename, OF_SHARE_DENY_WRITE, 0L); + ok(res == 0, "Unable to open file: error=%u\n", res); + ++ pStream0 = (void *)0xdeadbeef; ++ res = AVIFileGetStream(pFile, &pStream0, ~0, 0); ++ ok(res == AVIERR_NODATA, "expected AVIERR_NODATA, got %#x\n", res); ++ ok(pStream0 == NULL, "AVIFileGetStream should set stream to NULL\n"); ++ + res = AVIFileGetStream(pFile, &pStream0, 0, 0); + ok(res == 0, "Unable to open video stream: error=%u\n", res); + +-- +2.9.0 + diff --git a/patches/avifil32-AVIFileGetStream/definition b/patches/avifil32-AVIFileGetStream/definition new file mode 100644 index 00000000..45e2ed85 --- /dev/null +++ b/patches/avifil32-AVIFileGetStream/definition @@ -0,0 +1 @@ +Fixes: [41579] AVIFileGetStream should set stream to NULL in case of an error diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 02762b58..102c0386 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -90,6 +90,7 @@ patch_enable_all () enable_advapi32_LsaLookupSids="$1" enable_advapi32_SetSecurityInfo="$1" enable_api_ms_win_Stub_DLLs="$1" + enable_avifil32_AVIFileGetStream="$1" enable_avifil32_AVIFile_Proxies="$1" enable_avifil32_IGetFrame_fnSetFormat="$1" enable_avifile_dll16_AVIStreamGetFrame="$1" @@ -449,6 +450,9 @@ patch_enable () api-ms-win-Stub_DLLs) enable_api_ms_win_Stub_DLLs="$2" ;; + avifil32-AVIFileGetStream) + enable_avifil32_AVIFileGetStream="$2" + ;; avifil32-AVIFile_Proxies) enable_avifil32_AVIFile_Proxies="$2" ;; @@ -2730,6 +2734,21 @@ if test "$enable_api_ms_win_Stub_DLLs" -eq 1; then ) >> "$patchlist" fi +# Patchset avifil32-AVIFileGetStream +# | +# | This patchset fixes the following Wine bugs: +# | * [#41579] AVIFileGetStream should set stream to NULL in case of an error +# | +# | Modified files: +# | * dlls/avifil32/avifile.c, dlls/avifil32/tests/api.c +# | +if test "$enable_avifil32_AVIFileGetStream" -eq 1; then + patch_apply avifil32-AVIFileGetStream/0001-avifil32-AVIFileGetStream-should-set-stream-to-NULL-.patch + ( + echo '+ { "Dmitry Timoshkov", "avifil32: AVIFileGetStream should set stream to NULL in case of an error.", 1 },'; + ) >> "$patchlist" +fi + # Patchset avifil32-AVIFile_Proxies # | # | This patchset fixes the following Wine bugs: