diff options
author | Luke <luke.wilde@live.co.uk> | 2021-02-28 22:46:19 +0000 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-03-01 11:09:09 +0100 |
commit | 152af3a29793681feb3170f9b3801eb52992bab5 (patch) | |
tree | 6017567181fa40627c8d29985ed07e2c60f40948 | |
parent | 69df86c1d64d62316755f1e0d1df187047c176a1 (diff) | |
download | serenity-152af3a29793681feb3170f9b3801eb52992bab5.zip |
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.
-rw-r--r-- | Userland/Libraries/LibAudio/WavLoader.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Userland/Libraries/LibAudio/WavLoader.cpp b/Userland/Libraries/LibAudio/WavLoader.cpp index 28c2fb8277..3250e0e2b4 100644 --- a/Userland/Libraries/LibAudio/WavLoader.cpp +++ b/Userland/Libraries/LibAudio/WavLoader.cpp @@ -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; |