decoder/openmpt: catch libopenmpt exceptions in scan_stream()
Fixes crash bug.
This commit is contained in:
parent
2dacb36789
commit
5d35983298
@ -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
|
|||||||
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[] = {
|
||||||
|
Loading…
Reference in New Issue
Block a user