diff --git a/src/native/corehost/comhost/comhost.cpp b/src/native/corehost/comhost/comhost.cpp index 79050d4d7ff4db..6b7a67233b937b 100644 --- a/src/native/corehost/comhost/comhost.cpp +++ b/src/native/corehost/comhost/comhost.cpp @@ -198,6 +198,12 @@ COM_API HRESULT STDMETHODCALLTYPE DllGetClassObject( _In_ REFIID riid, _Outptr_ LPVOID FAR* ppv) { + if (ppv == nullptr) + return E_POINTER; + + // COM out parameters must always be initialized, including on failure paths. + *ppv = nullptr; + // Check if the CLSID map contains a mapping clsid_map map; RETURN_HRESULT_IF_EXCEPT(map = comhost::get_clsid_map());