ALSA: ctxfi - Fix possible buffer pointer overrun
Fix possible buffer pointer overruns. Back to zero when it's equal or over the buffer size. Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
514eef9c2a
commit
af8500bbbd
1 changed files with 4 additions and 0 deletions
|
@ -243,6 +243,8 @@ ct_pcm_playback_pointer(struct snd_pcm_substream *substream)
|
||||||
/* Read out playback position */
|
/* Read out playback position */
|
||||||
position = atc->pcm_playback_position(atc, apcm);
|
position = atc->pcm_playback_position(atc, apcm);
|
||||||
position = bytes_to_frames(runtime, position);
|
position = bytes_to_frames(runtime, position);
|
||||||
|
if (position >= runtime->buffer_size)
|
||||||
|
position = 0;
|
||||||
return position;
|
return position;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -343,6 +345,8 @@ ct_pcm_capture_pointer(struct snd_pcm_substream *substream)
|
||||||
/* Read out playback position */
|
/* Read out playback position */
|
||||||
position = atc->pcm_capture_position(atc, apcm);
|
position = atc->pcm_capture_position(atc, apcm);
|
||||||
position = bytes_to_frames(runtime, position);
|
position = bytes_to_frames(runtime, position);
|
||||||
|
if (position >= runtime->buffer_size)
|
||||||
|
position = 0;
|
||||||
return position;
|
return position;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue