-- v2: wineoss: Remove superflous check advpack: Add nullcheck for parameter that can be null (Coverity) mmdevapi: Add nullcheck for parameter that can be null (Coverity)
From: Fabian Maurer dark.shadow4@web.de
"out" got checked for null earlier, so we should do it here as well
Signed-off-by: Fabian Maurer dark.shadow4@web.de --- dlls/mmdevapi/client.c | 2 +- dlls/mmdevapi/tests/render.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/dlls/mmdevapi/client.c b/dlls/mmdevapi/client.c index a0a2b225c0b..6721b3c267e 100644 --- a/dlls/mmdevapi/client.c +++ b/dlls/mmdevapi/client.c @@ -480,7 +480,7 @@ HRESULT WINAPI client_IsFormatSupported(IAudioClient3 *iface, AUDCLNT_SHAREMODE
WINE_UNIX_CALL(is_format_supported, ¶ms);
- if (params.result == S_FALSE) + if (params.result == S_FALSE && out) *out = ¶ms.fmt_out->Format; else CoTaskMemFree(params.fmt_out); diff --git a/dlls/mmdevapi/tests/render.c b/dlls/mmdevapi/tests/render.c index 8e000f03acb..429ed6524b1 100644 --- a/dlls/mmdevapi/tests/render.c +++ b/dlls/mmdevapi/tests/render.c @@ -139,11 +139,23 @@ static void test_audioclient(void) HRESULT hr; ULONG ref; WAVEFORMATEX *pwfx, *pwfx2; + WAVEFORMATEXTENSIBLE format_float_error; REFERENCE_TIME t1, t2; HANDLE handle; BOOL offload_capable; AudioClientProperties client_props;
+ format_float_error.Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE); + format_float_error.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE; + format_float_error.Format.nAvgBytesPerSec = 384000; + format_float_error.Format.nBlockAlign = 8; + format_float_error.Format.nChannels = 2; + format_float_error.Format.nSamplesPerSec = 48000; + format_float_error.Format.wBitsPerSample = 32; + format_float_error.Samples.wValidBitsPerSample = 4; + format_float_error.dwChannelMask = 3; + format_float_error.SubFormat = KSDATAFORMAT_SUBTYPE_IEEE_FLOAT; + hr = IMMDevice_Activate(dev, &IID_IAudioClient3, CLSCTX_INPROC_SERVER, NULL, (void**)&ac3); ok(hr == S_OK || @@ -258,6 +270,11 @@ static void test_audioclient(void) "IsFormatSupported(Exclusive) call returns %08lx\n", hr); hexcl = hr;
+ hr = IAudioClient_IsFormatSupported(ac, AUDCLNT_SHAREMODE_EXCLUSIVE, &format_float_error.Format, NULL); + todo_wine + ok(hr == S_OK || hr == AUDCLNT_E_UNSUPPORTED_FORMAT || hr == AUDCLNT_E_EXCLUSIVE_MODE_NOT_ALLOWED, + "IsFormatSupported(Exclusive) call returns %08lx\n", hr); + pwfx2 = (WAVEFORMATEX*)0xDEADF00D; hr = IAudioClient_IsFormatSupported(ac, AUDCLNT_SHAREMODE_EXCLUSIVE, pwfx, &pwfx2); ok(hr == hexcl, "IsFormatSupported(Exclusive) call returns %08lx\n", hr);
From: Fabian Maurer dark.shadow4@web.de
--- dlls/advpack/install.c | 5 ++++- dlls/advpack/tests/install.c | 13 +++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/dlls/advpack/install.c b/dlls/advpack/install.c index deaa82d6d98..6f6a00dd4b0 100644 --- a/dlls/advpack/install.c +++ b/dlls/advpack/install.c @@ -591,7 +591,7 @@ HRESULT WINAPI ExecuteCabA(HWND hwnd, CABINFOA* pCab, LPVOID pReserved)
TRACE("(%p, %p, %p)\n", hwnd, pCab, pReserved);
- if (!pCab) + if (!pCab || !pCab->pszInf) return E_INVALIDARG;
if (pCab->pszCab) @@ -643,6 +643,9 @@ HRESULT WINAPI ExecuteCabW(HWND hwnd, CABINFOW* pCab, LPVOID pReserved)
TRACE("(%p, %p, %p)\n", hwnd, pCab, pReserved);
+ if (!pCab->pszInf) + return E_INVALIDARG; + ZeroMemory(&info, sizeof(ADVInfo));
if ((pCab->pszCab && *pCab->pszCab) && (pCab->pszInf && *pCab->pszInf) && *pCab->szSrcPath) diff --git a/dlls/advpack/tests/install.c b/dlls/advpack/tests/install.c index bdf02c5a397..fa1d68c5bef 100644 --- a/dlls/advpack/tests/install.c +++ b/dlls/advpack/tests/install.c @@ -262,6 +262,18 @@ static void test_LaunchINFSectionEx(void) DeleteFileA("test.inf"); }
+static void test_ExecuteCab(void) +{ + HRESULT hr; + CABINFOA cabinfoa = {0}; + CABINFOW cabinfow = {0}; + + hr = ExecuteCabA(0, &cabinfoa, 0); + ok(hr == E_INVALIDARG, "Got %lx\n", hr); + hr = ExecuteCabW(0, &cabinfow, 0); + ok(hr == E_INVALIDARG, "Got %lx\n", hr); +} + START_TEST(install) { DWORD len; @@ -289,6 +301,7 @@ START_TEST(install) test_RunSetupCommand(); test_LaunchINFSection(); test_LaunchINFSectionEx(); + test_ExecuteCab();
FreeLibrary(hAdvPack); SetCurrentDirectoryA(prev_path);
From: Fabian Maurer dark.shadow4@web.de
--- dlls/wineoss.drv/oss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/wineoss.drv/oss.c b/dlls/wineoss.drv/oss.c index 5049c711e98..4bbb624f359 100644 --- a/dlls/wineoss.drv/oss.c +++ b/dlls/wineoss.drv/oss.c @@ -535,7 +535,7 @@ static HRESULT setup_oss_device(AUDCLNT_SHAREMODE share, int fd, if(ret == S_FALSE && !out) ret = AUDCLNT_E_UNSUPPORTED_FORMAT;
- if(ret == S_FALSE && out){ + if(ret == S_FALSE){ closest->Format.nBlockAlign = closest->Format.nChannels * closest->Format.wBitsPerSample / 8; closest->Format.nAvgBytesPerSec =
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=133984
Your paranoid android.
=== w8adm (32 bit report) ===
mmdevapi: render.c:1359: Test failed: GetBuffer large (20671) at iteration 1
=== w864 (32 bit report) ===
mmdevapi: render.c:1359: Test failed: GetBuffer large (20671) at iteration 1
=== w1064v1507 (32 bit report) ===
mmdevapi: render.c:1359: Test failed: GetBuffer large (20671) at iteration 6
=== w1064v1809 (32 bit report) ===
mmdevapi: render.c:1359: Test failed: GetBuffer large (20671) at iteration 3
=== w7pro64 (64 bit report) ===
mmdevapi: render.c:768: Test failed: Wait(event) after Stop gave 102
=== w864 (64 bit report) ===
mmdevapi: render.c:1359: Test failed: GetBuffer large (20671) at iteration 8
=== w1064v1507 (64 bit report) ===
mmdevapi: render.c:1359: Test failed: GetBuffer large (20671) at iteration 7
=== w1064v1809 (64 bit report) ===
mmdevapi: render.c:1359: Test failed: GetBuffer large (20671) at iteration 2
=== w1064_2qxl (64 bit report) ===
mmdevapi: render.c:1359: Test failed: GetBuffer large (22500) at iteration 5
=== debian11 (32 bit report) ===
mmdevapi: render.c:275: Test succeeded inside todo block: IsFormatSupported(Exclusive) call returns 88890008
=== debian11 (32 bit ar:MA report) ===
mmdevapi: render.c:275: Test succeeded inside todo block: IsFormatSupported(Exclusive) call returns 88890008
=== debian11 (32 bit de report) ===
mmdevapi: render.c:275: Test succeeded inside todo block: IsFormatSupported(Exclusive) call returns 88890008
=== debian11 (32 bit fr report) ===
mmdevapi: render.c:275: Test succeeded inside todo block: IsFormatSupported(Exclusive) call returns 88890008
=== debian11 (32 bit he:IL report) ===
mmdevapi: render.c:275: Test succeeded inside todo block: IsFormatSupported(Exclusive) call returns 88890008
=== debian11 (32 bit hi:IN report) ===
mmdevapi: render.c:275: Test succeeded inside todo block: IsFormatSupported(Exclusive) call returns 88890008
=== debian11 (32 bit ja:JP report) ===
mmdevapi: render.c:275: Test succeeded inside todo block: IsFormatSupported(Exclusive) call returns 88890008
=== debian11 (32 bit zh:CN report) ===
mmdevapi: render.c:275: Test succeeded inside todo block: IsFormatSupported(Exclusive) call returns 88890008
=== debian11b (32 bit WoW report) ===
mmdevapi: render.c:275: Test succeeded inside todo block: IsFormatSupported(Exclusive) call returns 88890008
=== debian11b (64 bit WoW report) ===
mmdevapi: render.c:275: Test succeeded inside todo block: IsFormatSupported(Exclusive) call returns 88890008
On Tue Jun 20 09:01:44 2023 +0000, Huw Davies wrote:
I believe this is unnecessary as the driver should only return `S_FALSE` in the `AUDCLNT_SHAREMODE_SHARED` case where `out` will be non-NULL. However, it would be a good idea to move the parameter checks that are currently done in the first few lines of each driver into `mmdevapi` - @davidebeatrici something to add to the list (not really a priority though).
I added a test that crashes (when using pulse) due to this null dereference. In certain situations there is still a null reference, although I'm not 100% sure if that's the right place to check it. It's not supposed to return S_FALSE when it's NULL, see the tests. But I currently don't have a better idea, at least this gets rid of the crash.
Any news on this?
Could you split this so that the advpack commit is in a different MR?