Skip to content

Commit

Permalink
ALSA: ctxfi - Fix possible buffer pointer overrun
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Takashi Iwai committed Jun 8, 2009
1 parent 514eef9 commit af8500b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions sound/pci/ctxfi/ctpcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,8 @@ ct_pcm_playback_pointer(struct snd_pcm_substream *substream)
/* Read out playback position */
position = atc->pcm_playback_position(atc, apcm);
position = bytes_to_frames(runtime, position);
if (position >= runtime->buffer_size)
position = 0;
return position;
}

Expand Down Expand Up @@ -343,6 +345,8 @@ ct_pcm_capture_pointer(struct snd_pcm_substream *substream)
/* Read out playback position */
position = atc->pcm_capture_position(atc, apcm);
position = bytes_to_frames(runtime, position);
if (position >= runtime->buffer_size)
position = 0;
return position;
}

Expand Down

0 comments on commit af8500b

Please sign in to comment.