pulse plugin crash when stream has a hole

GitHub issues - edited github at alsa-project.org
Mon Dec 28 12:40:29 CET 2020


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


More information about the Alsa-devel mailing list