mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-21 18:37:58 +03:00
LibAudio: Initialize m_stream before parsing a FLAC header
Before this change opening the file in the system resulted in crash
caused by assertion saying:
SoundPlayer(32:32): ASSERTION FAILED: m_ptr
../.././AK/OwnPtr.h:139
[#0 SoundPlayer(32:32)]: Terminating SoundPlayer(32) due to signal 6
[#0 FinalizerTask(4:4)]: 0xdeadc0de
The issue was that 845d403b8c
started
using m_stream in the parse_header() function, but that variable wasn't
initialized if the Loader plugin was created using a file path
(which is used everywhere except for the fuzz testing),
resulting in a crash mentioned above.
This commit is contained in:
parent
07cc7eed29
commit
81261bc169
Notes:
sideshowbarker
2024-07-19 17:20:40 +09:00
Author: https://github.com/krkk Commit: https://github.com/SerenityOS/serenity/commit/81261bc1690 Pull-request: https://github.com/SerenityOS/serenity/pull/9184
@ -28,11 +28,15 @@ FlacLoaderPlugin::FlacLoaderPlugin(const StringView& path)
|
||||
return;
|
||||
}
|
||||
|
||||
m_stream = make<FlacInputStream>(Core::InputFileStream(*m_file));
|
||||
if (!m_stream) {
|
||||
m_error_string = String::formatted("Can't open memory stream");
|
||||
return;
|
||||
}
|
||||
|
||||
m_valid = parse_header();
|
||||
if (!m_valid)
|
||||
return;
|
||||
|
||||
m_stream = make<FlacInputStream>(Core::InputFileStream(*m_file));
|
||||
reset();
|
||||
if (!m_valid)
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user