[alsa-devel] Use-before-initialization in alsa-oss

Alexander E. Patrakov patrakov at ums.usu.ru
Sat Oct 6 12:16:57 CEST 2007


dsp->oss_format was used before it was set correctly

spotted by running "aoss flite_time 10:00"
Signed-Off-By: Alexander E. Patrakov

--- alsa-oss-1.0.14.orig/alsa/pcm.c	2007-09-29 16:12:44.000000000 +0600
+++ alsa-oss-1.0.14/alsa/pcm.c	2007-09-29 16:13:06.000000000 +0600
@@ -215,10 +215,10 @@
 		unsigned int rate, periods_min;
 		if (!pcm)
 			continue;
+		dsp->format = oss_format_to_alsa(dsp->oss_format);
 		str->frame_bytes = snd_pcm_format_physical_width(dsp->format) * dsp->channels / 8;
 		snd_pcm_hw_params_alloca(&hw);
 		snd_pcm_hw_params_any(pcm, hw);
-		dsp->format = oss_format_to_alsa(dsp->oss_format);
 
 		err = snd_pcm_hw_params_set_format(pcm, hw, dsp->format);
 		if (err < 0)



-- 
Alexander E. Patrakov


More information about the Alsa-devel mailing list