Commit 5d359832 authored by Max Kellermann's avatar Max Kellermann

decoder/openmpt: catch libopenmpt exceptions in scan_stream()

Fixes crash bug.
parent 2dacb367
...@@ -126,7 +126,7 @@ mod_decode(DecoderClient &client, InputStream &is) ...@@ -126,7 +126,7 @@ mod_decode(DecoderClient &client, InputStream &is)
static bool static bool
openmpt_scan_stream(InputStream &is, TagHandler &handler) noexcept openmpt_scan_stream(InputStream &is, TagHandler &handler) noexcept
{ try {
const auto buffer = mod_loadfile(&openmpt_domain, nullptr, is); const auto buffer = mod_loadfile(&openmpt_domain, nullptr, is);
if (buffer.IsNull()) { if (buffer.IsNull()) {
LogWarning(openmpt_domain, "could not load stream"); LogWarning(openmpt_domain, "could not load stream");
...@@ -145,6 +145,13 @@ openmpt_scan_stream(InputStream &is, TagHandler &handler) noexcept ...@@ -145,6 +145,13 @@ openmpt_scan_stream(InputStream &is, TagHandler &handler) noexcept
handler.OnTag(TAG_PERFORMER, mod.get_metadata("tracker").c_str()); handler.OnTag(TAG_PERFORMER, mod.get_metadata("tracker").c_str());
return true; return true;
} catch (...) {
/* libopenmpt usually throws openmpt::exception, but "may
additionally throw any exception thrown by the standard
library which are all derived from std::exception", we
let's just catch all here */
LogError(std::current_exception(), "libopenmpt failed");
return false;
} }
static const char *const mod_suffixes[] = { static const char *const mod_suffixes[] = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment