mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-24 18:24:45 -05:00
SoundPlayer: Don't try to dereference null-pointer buffers
d049626f40
tried to resample the buffer
before checking if it points to a valid location.
This caused a crash, generally at the end of the file.
This commit is contained in:
parent
0139a56aa5
commit
d81ba98976
Notes:
sideshowbarker
2024-07-19 17:15:47 +09:00
Author: https://github.com/krkk Commit: https://github.com/SerenityOS/serenity/commit/d81ba98976c Pull-request: https://github.com/SerenityOS/serenity/pull/9782
1 changed files with 5 additions and 4 deletions
|
@ -118,10 +118,11 @@ void PlaybackManager::next_buffer()
|
|||
|
||||
if (audio_server_remaining_samples < m_device_samples_per_buffer) {
|
||||
m_current_buffer = m_loader->get_more_samples(m_source_buffer_size_bytes);
|
||||
VERIFY(m_resampler.has_value());
|
||||
m_resampler->reset();
|
||||
m_current_buffer = Audio::resample_buffer(m_resampler.value(), *m_current_buffer);
|
||||
if (m_current_buffer)
|
||||
if (m_current_buffer) {
|
||||
VERIFY(m_resampler.has_value());
|
||||
m_resampler->reset();
|
||||
m_current_buffer = Audio::resample_buffer(m_resampler.value(), *m_current_buffer);
|
||||
m_connection->enqueue(*m_current_buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue