Alistair Leslie-Hughes : xactengine3_7: Return error on invalid notification value.
Alexandre Julliard
julliard at winehq.org
Thu Aug 4 14:46:39 CDT 2022
Module: wine
Branch: master
Commit: e43288348de170fef5dfd122675ba367dd7ea0ec
URL: https://gitlab.winehq.org/wine/wine/-/commit/e43288348de170fef5dfd122675ba367dd7ea0ec
Author: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date: Sun Jul 31 14:23:42 2022 +1000
xactengine3_7: Return error on invalid notification value.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
---
dlls/xactengine3_7/tests/xact3.c | 18 ++++++++++++++++++
dlls/xactengine3_7/xact_dll.c | 8 ++++++++
2 files changed, 26 insertions(+)
diff --git a/dlls/xactengine3_7/tests/xact3.c b/dlls/xactengine3_7/tests/xact3.c
index 6b66af59ff0..2a97f5f7c5c 100644
--- a/dlls/xactengine3_7/tests/xact3.c
+++ b/dlls/xactengine3_7/tests/xact3.c
@@ -208,6 +208,24 @@ static void test_notifications(void)
hr = IXACT3Engine_Initialize(engine, ¶ms);
ok(hr == S_OK, "Cannot initialize engine, hr %#lx\n", hr);
+ notification_desc.type = 0;
+ notification_desc.flags = 0;
+ notification_desc.pvContext = &prepared_data;
+ hr = IXACT3Engine_RegisterNotification(engine, ¬ification_desc);
+ ok(hr == E_INVALIDARG, "got hr %#lx\n", hr);
+
+ hr = IXACT3Engine_UnRegisterNotification(engine, ¬ification_desc);
+ ok(hr == S_OK, "got hr %#lx\n", hr);
+
+ notification_desc.type = XACTNOTIFICATIONTYPE_WAVEBANKSTREAMING_INVALIDCONTENT + 1;
+ notification_desc.flags = 0;
+ notification_desc.pvContext = &prepared_data;
+ hr = IXACT3Engine_RegisterNotification(engine, ¬ification_desc);
+ ok(hr == E_INVALIDARG, "got hr %#lx\n", hr);
+
+ hr = IXACT3Engine_UnRegisterNotification(engine, ¬ification_desc);
+ ok(hr == S_OK, "got hr %#lx\n", hr);
+
prepared_data.type = XACTNOTIFICATIONTYPE_WAVEBANKPREPARED;
prepared_data.thread_id = GetCurrentThreadId();
notification_desc.type = XACTNOTIFICATIONTYPE_WAVEBANKPREPARED;
diff --git a/dlls/xactengine3_7/xact_dll.c b/dlls/xactengine3_7/xact_dll.c
index cd72f43949f..f2737e0a9bd 100644
--- a/dlls/xactengine3_7/xact_dll.c
+++ b/dlls/xactengine3_7/xact_dll.c
@@ -1517,6 +1517,10 @@ static HRESULT WINAPI IXACT3EngineImpl_RegisterNotification(IXACT3Engine *iface,
TRACE("(%p)->(%p)\n", This, pNotificationDesc);
+ if (pNotificationDesc->type < XACTNOTIFICATIONTYPE_CUEPREPARED ||
+ pNotificationDesc->type > XACTNOTIFICATIONTYPE_WAVEBANKSTREAMING_INVALIDCONTENT)
+ return E_INVALIDARG;
+
unwrap_notificationdesc(&fdesc, pNotificationDesc);
This->contexts[pNotificationDesc->type] = pNotificationDesc->pvContext;
fdesc.pvContext = This;
@@ -1531,6 +1535,10 @@ static HRESULT WINAPI IXACT3EngineImpl_UnRegisterNotification(IXACT3Engine *ifac
TRACE("(%p)->(%p)\n", This, pNotificationDesc);
+ if (pNotificationDesc->type < XACTNOTIFICATIONTYPE_CUEPREPARED ||
+ pNotificationDesc->type > XACTNOTIFICATIONTYPE_WAVEBANKSTREAMING_INVALIDCONTENT)
+ return S_OK;
+
unwrap_notificationdesc(&fdesc, pNotificationDesc);
fdesc.pvContext = This;
return FACTAudioEngine_UnRegisterNotification(This->fact_engine, &fdesc);
More information about the wine-cvs
mailing list