https://bugs.kde.org/show_bug.cgi?id=366035

--- Comment #6 from Frederick Eaton <frede...@ofb.net> ---
Hi Philippe,

Thanks for responding.

I'm using Arch Linux, it's weird that the default Arch package is not
to your liking. Well I compiled from ABS adding (!strip debug) to
OPTIONS in /etc/makepkg.conf, the new version gives line numbers for
the backtrace. I attached the new output and also the output with the
verbose options you recommended.

> E.g. I do not see why the line after #ifndef BUG is needed: this seems to get 
> the nr of channels that were set just before ???

The program uses libsndfile and libasound (ALSA) as you can see. The
ALSA library has elaborate mechanisms to resolve differences between
settings that the user might request and restrictions that might be
imposed by the hardware device. I should have used the function
`snd_pcm_hw_params_set_channels_near` which takes a requested number
of channels and returns the actual number assigned.

http://alsa-lib.sourcearchive.com/documentation/1.0.8-3/group__PCM__HW__Params_g59aa9e1a02f4ce616fe92c605a833f8f.html#g59aa9e1a02f4ce616fe92c605a833f8f

In the original version I just called `snd_pcm_hw_params_set_channels`
and assumed the setting had been honored by ALSA. I requested 1
channel, ALSA created 2 channels per device constraints, I allocated
space for 32768 1-channel "frames", ALSA return 32768 2-channel
frames. I got a buffer overflow. I hope this answers your question. I
imagine that my original submission was a bit confusing.

The libraries are not too exotic, and although you need a soundcard
with stereo inputs to reproduce the bug I imagine that's not such a
rarity. However, let me know if the new files I submitted do not
resolve the mystery for you, and then I can maybe work on a more
minimal test case.

Thanks,

Frederick

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to