From: Takashi Iwai Subject: Re: [PATCH alsa-lib] pcm_dshare: Fix segfault when not binding channel 0 Date: Wed, 21 Nov 2018 11:02:12 +0100 Message-ID: References: <20181120204344.1623-1-kmarinushkin@birdec.tech> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 0BD642678DF for ; Wed, 21 Nov 2018 11:02:12 +0100 (CET) In-Reply-To: <20181120204344.1623-1-kmarinushkin@birdec.tech> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Kirill Marinushkin Cc: alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org On Tue, 20 Nov 2018 21:43:44 +0100, Kirill Marinushkin wrote: > > Configuration to reproduce: > > ~~~~ > pcm.share_right { > type dshare > ipc_key 73 > ipc_perm 0666 > slave { > pcm "hw:0,0" > } > bindings { > # the seagfault happens when we don't bind channel 0 > 1 1 > } > } > ~~~~ > > Execute to reproduce: > > ~~~~ > $ aplay -D plug:share_right test.wav > Playing WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo > Segmentation fault > ~~~~ > > For channels whithout binding, values are set to UINT_MAX in function > `snd_pcm_direct_parse_bindings()`: > > ~~~~ > for (chn = 0; chn < count; chn++) > bindings[chn] = UINT_MAX; /* don't route */ > ~~~~ > > But, these values are not checked when playing, which causes the segfault. > > This commit fixes the issue. > > Signed-off-by: Kirill Marinushkin Applied, thanks. Takashi