Skip to contentSkip to conversation

pulse plugin crash when stream has a hole

DISCUSSION GitHub issues - edited 1 participant 1 message Dec 28, 2020 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

alsa-project/alsa-plugins issue #16 was edited from i-garrison:

Following up on this debian bug report https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=824850

Looks like this crash is caused by missing stream hole handling in pulse plugin. Pulseaudio change was done just before pulseaudio-v3.0 release and this issue should be reproducible with all current versions: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/commit/dfd44036b54d65314664622ff93dfd18eee03c7b quoting from there:

```
... let the caller decide how the holes should be handled, so
in case of holes, pa_stream_peek() will return NULL data pointer and
the length of the hole in the nbytes argument
```

Here in pulse plugin, if there is a hole in stream pa_stream_peek would return NULL buffer pointer but non-zero frag_length and later memcpy is happily trying to copy from NULL source:
https://github.com/alsa-project/alsa-plugins/blob/7028580da1db9a2362dd9b0631d7f667b373c313/pulse/pcm_pulse.c#L517-L534

Instead, pulse plugin should detect there is a hole by checking if src_buf is still NULL while frag_length is not zero, and adjust transfer result accordingly.

Issue URL : https://github.com/alsa-project/alsa-plugins/issues/16
Repository URL: https://github.com/alsa-project/alsa-plugins