NULL PTR deref in src/pipewire/utils.c
In Gnome3 41 port for FreeBSD there are crashes in a few places like Users tab in gnome-control-center
and cheese
caused by NULL PTR deref in pw_split_walk. Here's a sample backtrace:
Thread 1 received signal SIGSEGV, Segmentation fault.
Address not mapped to object.
0x0000000801477aa6 in strspn () from /lib/libc.so.7
(gdb) bt
#0 0x0000000801477aa6 in strspn () at /lib/libc.so.7
#1 0x000000081a612569 in pw_split_walk () at /usr/local/lib/libpipewire-0.3.so.0
#2 0x000000081a5f7c51 in pw_load_spa_handle () at /usr/local/lib/libpipewire-0.3.so.0
#3 0x000000081a5e9147 in pw_loop_new () at /usr/local/lib/libpipewire-0.3.so.0
...
Following workaround fixes the crashes (see lines 1,2,3)
pipewire-0.3.36/src/pipewire/utils.c:
SPA_EXPORT
const char *pw_split_walk(const char *str, const char *delimiter, size_t * len, const char **state)
{
const char *s = *state ? *state : str;
1 // *** ADDED FOLLOWING TWO LINES TO AVOID SIGSEGV ***
2 if (s == NULL)
3 return NULL;
s += strspn(s, delimiter);
if (*s == '\0')
return NULL;
*len = strcspn(s, delimiter);
*state = s + *len;
return s;
}