[Pkg-alsa-devel] Bug#539454: Bug#539454: libasound2: Division by zero in pcm_rate.c when period_size->min == 0

Elimar Riesebieter riesebie at lxtec.de
Thu Aug 6 19:40:04 UTC 2009


forwarded 539454 alsa-devel at alsa-project.org
tags 539454 + patch

thanks

Hi,

this is Debian bug 539454. It would be better to fix it in general.
Patching the Debian Package isn't a reasonable solution.

Thanks
Elimar


* John Lindgren [090731 22:29 -0400]
> Package: libasound2
> Version: 1.0.20-2
> Severity: important
> Tags: patch
> 
> 
> System: Dell Inspiron 1200
> Card: Intel ICH6
> Chip: SigmaTel STAC9752,53
> 
> 
> Steps to reproduce:
> 
> 1. Disable dmix: mv /usr/share/alsa/cards/ICH4.conf /usr/share/alsa/cards/ICH4.conf.0
> 2. Restart ALSA: /etc/rcS.d/S50alsa-utils restart
> 3. Clear Audacity configuration: rm -r ~/.audacity*
> 4. Run Audacity 1.3.7-3 in Valgrind: valgrind --tool=none audacity
> 5. Choose "OK" in the "Audacity First Run" dialog.
> 
> 
> Valgrind output:
> 
> ==26237== Process terminating with default action of signal 8 (SIGFPE)
> ==26237==  Integer divide by zero at address 0x64D1CD56
> ==26237==    at 0x4CAD600: snd_pcm_rate_hw_refine_cchange (pcm_rate.c:189)
> ==26237==    by 0x4C97B2E: snd1_pcm_hw_refine_slave (pcm_params.c:2182)
> ==26237==    by 0x4CAD7D5: snd_pcm_rate_hw_refine (pcm_rate.c:222)
> ==26237==    by 0x4C96015: snd_pcm_hw_refine (pcm_params.c:2264)
> ==26237==    by 0x4CA116B: snd1_pcm_generic_hw_refine (pcm_generic.c:98)
> ==26237==    by 0x4C97B0D: snd1_pcm_hw_refine_slave (pcm_params.c:2158)
> ==26237==    by 0x4CC0E25: snd_pcm_lfloat_hw_refine (pcm_lfloat.c:261)
> ==26237==    by 0x4C96015: snd_pcm_hw_refine (pcm_params.c:2264)
> ==26237==    by 0x4C99068: sndrv_pcm_hw_params (pcm_params.c:2290)
> ==26237==    by 0x4CB209C: snd_pcm_plug_hw_params (pcm_plug.c:1045)
> ==26237==    by 0x4C9921D: sndrv_pcm_hw_params (pcm_params.c:2299)
> ==26237==    by 0x4C947B0: snd_pcm_hw_params (pcm.c:822)
> 
> 
> Diagnosis:
> 
> pcm_rate.c:189 reads:
> 
>         if ((buffer_size->min / period_size->min) * period_size->min == buffer_size->min) {
> 
> When using the ICH4 driver without dmix, period_size->min == 0. Handle
> this by changing pcm_rate.c:189 to:
> 
>         if (period_size->min > 0 && (buffer_size->min / period_size->min) * period_size->min == buffer_size->min) {
> 
> With this change, Audacity starts without problems.

Patch against native 1.0.20:

diff -Naurd a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c
--- a/src/pcm/pcm_rate.c	2009-05-06 09:07:23.000000000 +0200
+++ b/src/pcm/pcm_rate.c	2009-08-06 21:34:23.000000000 +0200
@@ -186,7 +186,7 @@
 		if (!snd_interval_checkempty(period_size) &&
 		    period_size->openmin && period_size->openmax &&
 		    period_size->min + 1 == period_size->max) {
-		    	if ((buffer_size->min / period_size->min) * period_size->min == buffer_size->min) {
+			if (period_size->min > 0 && (buffer_size->min / period_size->min) * period_size->min == buffer_size->min) {
 		    		snd_interval_set_value(period_size, period_size->min);
 		    	} else if ((buffer_size->max / period_size->max) * period_size->max == buffer_size->max) {
 		    		snd_interval_set_value(period_size, period_size->max);


-- 
  Experience is something you don't get until 
  just after you need it!





More information about the Pkg-alsa-devel mailing list