Added patch to set stream to NULL if AVIFileGetStream fails with an error.

This commit is contained in:
Sebastian Lackner 2016-11-15 17:07:31 +01:00
parent ce0c9566c9
commit a43657f683
3 changed files with 62 additions and 0 deletions

View File

@ -0,0 +1,42 @@
From 64ce8c391c3706a2b3ce9b5f8f76710d5751a766 Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
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

View File

@ -0,0 +1 @@
Fixes: [41579] AVIFileGetStream should set stream to NULL in case of an error

View File

@ -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: