mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 06:27:45 +00: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
1 changed files with 2 additions and 2 deletions
|
@ -192,8 +192,8 @@ bool WavLoaderPlugin::parse_header()
|
||||||
u16 audio_format = read_u16();
|
u16 audio_format = read_u16();
|
||||||
CHECK_OK("Audio format"); // incomplete read check
|
CHECK_OK("Audio format"); // incomplete read check
|
||||||
ok = ok && audio_format == 1; // WAVE_FORMAT_PCM
|
ok = ok && audio_format == 1; // WAVE_FORMAT_PCM
|
||||||
|
CHECK_OK("Audio format"); // value check
|
||||||
VERIFY(audio_format == 1);
|
VERIFY(audio_format == 1);
|
||||||
CHECK_OK("Audio format"); // value check
|
|
||||||
|
|
||||||
m_num_channels = read_u16();
|
m_num_channels = read_u16();
|
||||||
ok = ok && (m_num_channels == 1 || m_num_channels == 2);
|
ok = ok && (m_num_channels == 1 || m_num_channels == 2);
|
||||||
|
@ -211,8 +211,8 @@ bool WavLoaderPlugin::parse_header()
|
||||||
m_bits_per_sample = read_u16();
|
m_bits_per_sample = read_u16();
|
||||||
CHECK_OK("Bits per sample"); // incomplete read check
|
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);
|
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
|
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
|
// Read chunks until we find DATA
|
||||||
bool found_data = false;
|
bool found_data = false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue