mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-07 19:57:45 +03:00
LibAudio: Move format and BPS checks before VERIFYs in WAV loader
It was accidentally checking the format/bits per sample too late, which would crash with the assertion.
This commit is contained in:
parent
69df86c1d6
commit
152af3a297
Notes:
sideshowbarker
2024-07-18 21:50:15 +09:00
Author: https://github.com/Lubrsi Commit: https://github.com/SerenityOS/serenity/commit/152af3a2979 Pull-request: https://github.com/SerenityOS/serenity/pull/5581
@ -192,8 +192,8 @@ bool WavLoaderPlugin::parse_header()
|
||||
u16 audio_format = read_u16();
|
||||
CHECK_OK("Audio format"); // incomplete read check
|
||||
ok = ok && audio_format == 1; // WAVE_FORMAT_PCM
|
||||
CHECK_OK("Audio format"); // value check
|
||||
VERIFY(audio_format == 1);
|
||||
CHECK_OK("Audio format"); // value check
|
||||
|
||||
m_num_channels = read_u16();
|
||||
ok = ok && (m_num_channels == 1 || m_num_channels == 2);
|
||||
@ -211,8 +211,8 @@ bool WavLoaderPlugin::parse_header()
|
||||
m_bits_per_sample = read_u16();
|
||||
CHECK_OK("Bits per sample"); // incomplete read check
|
||||
ok = ok && (m_bits_per_sample == 8 || m_bits_per_sample == 16 || m_bits_per_sample == 24);
|
||||
VERIFY(m_bits_per_sample == 8 || m_bits_per_sample == 16 || m_bits_per_sample == 24);
|
||||
CHECK_OK("Bits per sample"); // value check
|
||||
VERIFY(m_bits_per_sample == 8 || m_bits_per_sample == 16 || m_bits_per_sample == 24);
|
||||
|
||||
// Read chunks until we find DATA
|
||||
bool found_data = false;
|
||||
|
Loading…
Reference in New Issue
Block a user