mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 05:54:58 +00:00
LibAudio: Prevent int overflow in the user buffer queue
The `UserSampleQueue::remaining_samples` calculates the result by subtracting two unsigned int numbers. That can lead to integer overflow. Add an assert to verify that the minuend is greater or equal to the subtrahend.
This commit is contained in:
parent
451ae985bf
commit
5f67d002a2
1 changed files with 1 additions and 0 deletions
|
@ -51,6 +51,7 @@ size_t UserSampleQueue::size()
|
|||
size_t UserSampleQueue::remaining_samples()
|
||||
{
|
||||
Threading::MutexLocker lock(m_sample_mutex);
|
||||
VERIFY(m_backing_samples.size() >= m_samples_to_discard);
|
||||
return m_backing_samples.size() - m_samples_to_discard;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue