Skip to content

Commit

Permalink
audio: audio_generic_get_buffer_in should honor *size
Browse files Browse the repository at this point in the history
The function generic_get_buffer_in currently ignores the *size
parameter and may return a buffer larger than *size.

As a result the variable samples in function
audio_pcm_hw_run_in may underflow. The while loop then most
likely will never termiate.

Buglink: http://bugs.debian.org/948658
Signed-off-by: Volker Rümelin <[email protected]>
Message-Id: <[email protected]>
Signed-off-by: Gerd Hoffmann <[email protected]>
  • Loading branch information
Volker Rümelin authored and kraxel committed Jan 31, 2020
1 parent f03cd06 commit 599eac4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion audio/audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1407,7 +1407,8 @@ void *audio_generic_get_buffer_in(HWVoiceIn *hw, size_t *size)
}
assert(start >= 0 && start < hw->size_emul);

*size = MIN(hw->pending_emul, hw->size_emul - start);
*size = MIN(*size, hw->pending_emul);
*size = MIN(*size, hw->size_emul - start);
return hw->buf_emul + start;
}

Expand Down

0 comments on commit 599eac4

Please sign in to comment.