mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-09 17:44:56 +09: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
Notes:
sideshowbarker
2024-07-17 04:49:48 +09:00
Author: https://github.com/achronop
Commit: 5f67d002a2
Pull-request: https://github.com/SerenityOS/serenity/pull/16309
Reviewed-by: https://github.com/kleinesfilmroellchen ✅
Reviewed-by: https://github.com/linusg
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