Bug#539454: libasound2: Division by zero in pcm_rate.c when period_size->min == 0
A message that is not in the archive (sent off-list or not yet received): 1249093791.23117.18.camel@dark-knight
forwarded 539454 [email protected]
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]
Quoted 42 lines
Package: libasound2
Version: 1.0.20-2
Severity: important
Tags: patchSystem: Dell Inspiron 1200
Card: Intel ICH6
Chip: SigmaTel STAC9752,53Steps 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-utilsrestart
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:
Quoted 8 lines
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:
src/pcm/pcm_rate.c +1 -1
@@ -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);
Signature · 2 lines
Experience is something you don't get until just after you need it!
Takashi Iwai
AppliedAt Thu, 6 Aug 2009 21:40:04 +0200,
Quoted 10 lines · Elimar Riesebieter
forwarded 539454 [email protected]
tags 539454 + patchthanks
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, applied now to GIT tree.
Takashi
Quoted 81 lines
Thanks
Elimar* John Lindgren [090731 22:29 -0400]
Quoted 42 lines
Package: libasound2
Version: 1.0.20-2
Severity: important
Tags: patchSystem: Dell Inspiron 1200
Card: Intel ICH6
Chip: SigmaTel STAC9752,53Steps 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-utilsrestart
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:
Quoted 8 lines
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.cb/src/pcm/pcm_rate.csrc/pcm/pcm_rate.c +1
-1@@ -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);Signature · 7 lines
-- Experience is something you don't get until just after you need it! _______________________________________________ Alsa-devel mailing list [email protected] http://mailman.alsa-project.org/mailman/listinfo/alsa-devel