Hi Takashi,
see attached the patch.
From my opinion failing with an error is the best solution (see explanation in the commit message)
Best regards
Timo Wischer
Advanced Driver Information Technology GmbH Engineering Software Base (ADITG/ESB) Robert-Bosch-Str. 200 31139 Hildesheim Germany
Tel. +49 5121 49 6938 Fax +49 5121 49 6999 twischer@de.adit-jv.com
ADIT is a joint venture company of Robert Bosch GmbH/Robert Bosch Car Multimedia GmbH and DENSO Corporation Sitz: Hildesheim, Registergericht: Amtsgericht Hildesheim HRB 3438 Geschäftsführung: Wilhelm Grabow, Ken Yaguchi
________________________________________ From: Takashi Iwai [tiwai@suse.de] Sent: Thursday, October 05, 2017 3:17 PM To: Wischer, Timo (ADITG/ESB) Cc: alsa-devel@alsa-project.org Subject: Re: [alsa-devel] SEGFault when optininal snd_ctl_ext_callback::read_event() not set
On Thu, 05 Oct 2017 14:03:14 +0200, Wischer, Timo (ADITG/ESB) wrote:
Hi all,
snd_ctl_ext_callback::read_event() callback is mentioned as optional (see http://git.alsa-project.org/?p=alsa-lib.git;a=blob;f=include/control_externa...)
but there is no NULL check and the NULL pointer will be called if the read_event function callback pointer is not set. (see http://git.alsa-project.org/?p=alsa-lib.git;a=blob;f=src/control/control_ext...)
I think a default function has to be provided which will be called when the callback is not set or the read_event() callback should not be marked as optional.
What is your opinion?
It should have a NULL check there, as documentation clearly states that it's optional.
Care to submit a fix patch?
thanks,
Takashi