Skip to contentSkip to conversation

: SIGSEGV in snd_pcm_rate_drain

ALSA - driver 0001878 [email protected] 1 participant 1 message Mar 2, 2006

lore
Share & tools
lore
#0 lore raw

A NOTE has been added to this issue.
======================================================================
<https://bugtrack.alsa-project.org/alsa-bug/view.php?id=1878>
======================================================================
Reported By: Faust3
Assigned To:
======================================================================

Project:                    ALSA - driver
Issue ID:                   1878
Category:                   CORE - pcm
Reproducibility:            sometimes
Severity:                   crash
Priority:                   normal
Status:                     new
Distribution:               
Kernel Version:             
======================================================================
Date Submitted:             02-25-2006 14:08 CET
Last Modified:              03-02-2006 15:45 CET

======================================================================
Summary: SIGSEGV in snd_pcm_rate_drain
Description:
Program received signal SIGSEGV, Segmentation fault. [Switching to Thread -1217157440 (LWP 13093)]
0xb7e809b6 in snd_pcm_area_copy (dst_area=0x86b58c8, dst_offset=0, src_area=0x86b5508, src_offset=4096, samples=4294964224, format=SND_PCM_FORMAT_S16_LE) at pcm.c:2551
2551 *(u_int16_t*)dst = *(const
u_int16_t*)src;
(gdb) bt
#0 0xb7e809b6 in snd_pcm_area_copy (dst_area=0x86b58c8, dst_offset=0, src_area=0x86b5508, src_offset=4096, samples=4294964224, format=SND_PCM_FORMAT_S16_LE)

    at pcm.c:2551
#1  0xb7e80c53 in snd_pcm_areas_copy (dst_areas=0x86b58c8, dst_offset=0,
src_areas=0x86b5514, src_offset=4096, channels=2, frames=4294964224,
    format=SND_PCM_FORMAT_S16_LE) at pcm.c:2650
#2  0xb7e95d84 in snd_pcm_rate_commit_area (pcm=0x86b71d0, rate=0x86b7118,
appl_offset=10752, size=11636, slave_size=17360) at pcm_rate.c:1067
#3  0xb7e9653d in snd_pcm_rate_drain (pcm=0x86b71d0) at pcm_rate.c:1306
#4  0xb7e771d2 in snd_pcm_drain (pcm=0x86b5940) at pcm.c:1057
#5  0x080c9068 in uninit (immed=0) at ao_alsa.c:658
#6  0x0807353d in uninit_player (mask=3659) at mplayer.c:485
#7  0x08077d16 in main (argc=5, argv=0xbfb775b4) at mplayer.c:4488

Problem seems to be that cont=4096 and period_size=1024 in snd_pcm_rate_commit_area just before calling snd_pcm_areas_copy. With cont being unsigned the following calculation will overflow

cont = rate->gen.slave->period_size - cont;
slave_frames = cont;

Tell me if you need more info.

======================================================================

----------------------------------------------------------------------
tiwai - 03-02-06 15:45
----------------------------------------------------------------------
Does the attached patch fix the problem?

Issue History
Date Modified Username Field Change
======================================================================

02-25-06 14:08 Faust3         New Issue                                    
02-25-06 14:09 Faust3         Issue Monitored: Faust3                      
03-02-06 15:45 tiwai          Note Added: 0008311                          

======================================================================

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642