[pulseaudio-discuss] Segfault at saving legacy database entries

David Henningsson david.henningsson at canonical.com
Thu Sep 1 01:57:17 PDT 2011


I tested the converter from the legacy (0.9.23) format to the new format 
and I think I've found a bug, but I'm unsure how to best fix it. Maybe 
Colin (who is more into the format) would know better?

The problem:

entry_read (in module-device-restore.c) is called from firing the 
PA_CORE_HOOK_SINK_NEW hook (see sink_new_hook_callback). Entry_read 
reads the old sink entry successfully and tries to iterate sink->ports. 
However, sink->ports is garbage is that point (as the sink is allocated 
with xmalloc, not xmalloc0), and so segfault is possible. sink->ports is 
not set until after the PA_CORE_HOOK_SINK_NEW hook has finished.

Possible solutions include e g setting sink->ports earlier as well as 
listening to pa_sink_fixate instead of pa_sink_new, but I wonder if any 
of them may have unwanted side effects? Or maybe save a temporary 
null-port entry that is used later (as a fallback is there is no port 
entry)?

-- 
David Henningsson, Canonical Ltd.
http://launchpad.net/~diwic


More information about the pulseaudio-discuss mailing list