Bug 437879

Summary: Segfault in Card::sources on 1.3 on Pinephone
Product: [Frameworks and Libraries] pulseaudio-qt Reporter: me
Component: generalAssignee: Nicolas Fella <nicolas.fella>
Status: RESOLVED FIXED    
Severity: crash CC: bhush94
Priority: NOR    
Version: 1.3   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description me 2021-05-30 22:39:33 UTC
SUMMARY
When using plasma-dialer when using version 1.3 (compiled from master) of the library on the Pinephone, this library causes a segmentation fault. Running under LLDB shows the issue is with Card::sources, specifically the issue is that IndexedPulseObject::d points to invalid memory:

* thread #1, name = 'plasmaphonedial', stop reason = signal SIGSEGV: invalid address (fault address: 0x18)
    frame #0: 0x0000fffff78fb948 libKF5PulseAudioQt.so.3`PulseAudioQt::Card::sources(this=0x0000000000000000) const at card.cpp:155:56
   152 
   153      const auto allSources = Context::instance()->sources();
   154      for (Source *source : allSources) {
-> 155          if (source->cardIndex() == IndexedPulseObject::d->m_index) {
   156              ret << source;
   157          }
   158      }

STEPS TO REPRODUCE
1. Make a call in plasma-dialer

OBSERVED RESULT
It crashes.

EXPECTED RESULT
It does not crash.

SOFTWARE/OS VERSIONS
Running Manjaro-ARM
plasma-dialer and pulseaudio-qt are compiled from source (on master branch)
KDE Plasma 5.21.5
Frameworks 5.82.0
Qt 5.15.2
Kernel 5.12.2-2-MANJARO-ARM
Comment 1 Bhushan Shah 2021-05-31 10:12:59 UTC
Did you also update UCM to newer version?
Comment 2 Bhushan Shah 2021-05-31 10:13:49 UTC
Latest version with which it is tested is, https://gitlab.com/pine64-org/pine64-alsa-ucm (/usr/share/alsa/ucm2/PinePhone/)
Comment 3 Bhushan Shah 2021-05-31 10:15:04 UTC
Also, can you upload full output of the plasma-dialer?
Comment 4 Bug Janitor Service 2021-05-31 10:26:33 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma-mobile/plasma-dialer/-/merge_requests/62
Comment 5 Bhushan Shah 2021-05-31 22:29:03 UTC
Git commit 0c10171436a1dac0a4735fa1b03409aac670b786 by Bhushan Shah.
Committed on 31/05/2021 at 10:24.
Pushed by bshah into branch 'master'.

Fix crash if used with wrong UCM

Wrong/old UCM does not have some proper namings, which means it will not
find earpiece/speaker and mic ports and m_voiceCallCard will never be
set. While this means audio will not work, at least guard against the
crasher.

M  +5    -0    src/callaudio.cpp

https://invent.kde.org/plasma-mobile/plasma-dialer/commit/0c10171436a1dac0a4735fa1b03409aac670b786