Bug Report DirectShow Source device init failure crash

R1CH

Forum Admin
Developer
If a DirectShow device fails to initialize, OBS crashes from numerous uninitialized memory reads.

Code:
diff --git a/DShowPlugin/DeviceSource.cpp b/DShowPlugin/DeviceSource.cpp
index 0d95239..c7632cb 100644
--- a/DShowPlugin/DeviceSource.cpp
+++ b/DShowPlugin/DeviceSource.cpp
@@ -87,10 +87,10 @@ bool DeviceSource::LoadFilters()
     bool bSucceeded = false;

     List<MediaOutputInfo> outputList;
-    IAMStreamConfig *config;
-    bool bAddedCapture, bAddedDevice;
+    IAMStreamConfig *config = NULL;
+    bool bAddedCapture = false, bAddedDevice = false;
     GUID expectedMediaType;
-    IPin *devicePin;
+    IPin *devicePin = NULL;
     HRESULT err;

     String strDevice = data->GetString(TEXT("device"));
 

Lain

Forum Admin
Lain
Forum Moderator
Developer
Ah, thank you! Putting in the diff. If you want full git access some time, let me know. Will always give credit where credit is due as well. Sorry that you're having to rummage around in my not-always-so-clean/documented/commented code, with all my ancient custom written-from-scratch classes and structures.
 
Top