Ports hashmap contains dangling pointers

Bug #932804 reported by David Henningsson
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pulseaudio (Ubuntu)
Fix Released
Medium
David Henningsson

Bug Description

sink->ports hashmap contains dangling pointers if we have "settings", at least in precise.

Tags: precise

Related branches

Changed in pulseaudio (Ubuntu):
status: New → In Progress
importance: Undecided → High
assignee: nobody → David Henningsson (diwic)
importance: High → Medium
Revision history for this message
David Henningsson (diwic) wrote : [PATCH] alsa-mixer: Don't use dangling pointers as port hashmap keys

If alsa settings/options were used, the string to construct the
name was freed, leading to dangling pointers to strings inside
the hashmap.

BugLink: https://bugs.launchpad.net/bugs/932804
Signed-off-by: David Henningsson <email address hidden>
---
 src/modules/alsa/alsa-mixer.c | 4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c
index 9bf8069..7e6ef54 100644
--- a/src/modules/alsa/alsa-mixer.c
+++ b/src/modules/alsa/alsa-mixer.c
@@ -4397,7 +4397,7 @@ static pa_device_port* device_port_alsa_init(pa_hashmap *ports,

         p = pa_device_port_new(core, name, description, sizeof(pa_alsa_port_data));
         pa_assert(p);
- pa_hashmap_put(ports, name, p);
+ pa_hashmap_put(ports, p->name, p);
         p->profiles = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);

         data = PA_DEVICE_PORT_DATA(p);
@@ -4412,7 +4412,7 @@ static pa_device_port* device_port_alsa_init(pa_hashmap *ports,
         pa_hashmap_put(p->profiles, cp->name, cp);

     if (extra) {
- pa_hashmap_put(extra, name, p);
+ pa_hashmap_put(extra, p->name, p);
         pa_device_port_ref(p);
     }

--
1.7.9

tags: added: precise
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package pulseaudio - 1:1.1-0ubuntu8

---------------
pulseaudio (1:1.1-0ubuntu8) precise; urgency=low

  [ David Henningsson ]
  * Make sure we switch away from unavailable ports at
    startup (LP: #928914)
  * 0020-Fix-Darth-Vader-panning-bug.patch:
    Fix distorted sound when panned hard left (or right). (LP: #928757)
  * 0618-alsa-mixer-Don-t-use-dangling-pointers-as-port-hashm.patch:
    Fix inability to set port when options were used (LP: #932804)
  * Minimize margins for deferred volumes, as a workaround for volume
    changes being dropped on port change.
  * 0610-Jack-detection-kcontrol-implementation.patch:
    Fix a bug in the headphone path
 -- Luke Yelavich <email address hidden> Fri, 17 Feb 2012 07:28:23 +1100

Changed in pulseaudio (Ubuntu):
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.