[PATCH v5 2/8] mf: Check for empty argument and insufficient nodes in _Load.

Sergio Gómez Del Real sdelreal at codeweavers.com
Wed Apr 22 22:28:29 CDT 2020


Signed-off-by: Sergio Gómez Del Real <sdelreal at codeweavers.com>
---
 dlls/mf/tests/mf.c | 2 --
 dlls/mf/topology.c | 3 +++
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c
index 72fad1c77e..3fe89d0456 100644
--- a/dlls/mf/tests/mf.c
+++ b/dlls/mf/tests/mf.c
@@ -1652,7 +1652,6 @@ static void test_topology_loader(void)
 
     /* Empty topology */
     hr = IMFTopoLoader_Load(loader, topology, &full_topology, NULL);
-todo_wine
     ok(hr == MF_E_TOPO_UNSUPPORTED, "Unexpected hr %#x.\n", hr);
 
     hr = MFCreateMediaType(&mediatypes_pd[0]);
@@ -1700,7 +1699,6 @@ todo_wine
 
     /* Source node only. */
     hr = IMFTopoLoader_Load(loader, topology, &full_topology, NULL);
-todo_wine
     ok(hr == MF_E_TOPO_UNSUPPORTED, "Unexpected hr %#x.\n", hr);
 
     /* Add grabber sink. */
diff --git a/dlls/mf/topology.c b/dlls/mf/topology.c
index 0b4d734442..72cb6062cc 100644
--- a/dlls/mf/topology.c
+++ b/dlls/mf/topology.c
@@ -1926,6 +1926,9 @@ static HRESULT WINAPI topology_loader_Load(IMFTopoLoader *iface, IMFTopology *in
     if (current_topology)
         FIXME("Current topology instance is ignored.\n");
 
+    if (!topology || topology->nodes.count < 2)
+        return MF_E_TOPO_UNSUPPORTED;
+
     for (i = 0; i < topology->nodes.count; ++i)
     {
         struct topology_node *node = topology->nodes.nodes[i];
-- 
2.17.1




More information about the wine-devel mailing list