Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • W wireplumber
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 87
    • Issues 87
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 3
    • Merge requests 3
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • PipeWire
  • wireplumber
  • Issues
  • #113
Closed
Open
Created Nov 18, 2021 by Peter Hutterer@whotOwner

wp_impl_node_new_from_pw_factory() segfaults for factory client-node

I don't know if this is a bug in the client-node factory or wireplumber or in my understanding of what this function can be used for.

wp_impl_node_new_from_pw_factory() always passes NULL as resource down to pw_impl_factory_create_object(). In the case of client-node, the resource is unconditionally used to determine the client and crashes with a NULL-pointer dereference.

$ cat -n src/modules/module-client-node.c
70	
71	static void *create_object(void *_data,
72				   struct pw_resource *resource,
73				   const char *type,
74				   uint32_t version,
75				   struct pw_properties *properties,
76				   uint32_t new_id)
77	{
78		void *result;
79		struct pw_resource *node_resource;
80		struct pw_impl_client *client = pw_resource_get_client(resource);
81		int res;
82	

module-client-device has the same code, so it segfaults too.

Minimal reproducer:

// gcc -Wall -o test `pkg-config --cflags --libs wireplumber-0.4 glib-2.0` test.c

#include <stdio.h>
#include <wp/wp.h>

static void
callback(WpCore *core, void *data)
{
	printf("... connected\n");
	g_autoptr(WpImplNode) node = wp_impl_node_new_from_pw_factory(core, "client-node", NULL);
}

int main(void)
{
	wp_init(WP_INIT_ALL);

	g_autoptr(GMainLoop) loop = g_main_loop_new (NULL, FALSE);
	g_autoptr(WpCore) core = wp_core_new(NULL, NULL);

	wp_core_connect(core);
	g_signal_connect(core, "connected", (GCallback)callback, NULL);
	g_main_loop_run(loop);

	return 0;
}
Assignee
Assign to
Time tracking