1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-03 14:13:11 +02:00

Bug 421 - Crash importing malformed MP3 file using libmad

This adds LAME tag handling and bad MP3 detection, but
it's pretty much a complete rewrite, so plenty of testing
is needed.
This commit is contained in:
Leland Lucius 2020-05-23 22:03:41 -05:00
parent 8ce72748bf
commit 35e88d995b
2 changed files with 793 additions and 358 deletions

View File

@ -578,24 +578,6 @@ bool Importer::Import( AudacityProject &project,
{
if (plugin->SupportsExtension(extension))
{
// If libmad is accidentally fed a wav file which has been incorrectly
// given an .mp3 extension then it can choke on the contents and crash.
// To avoid this, put libsndfile ahead of libmad in the lists created for
// mp3 files, or for any of the extensions supported by libmad.
// A genuine .mp3 file will first fail an attempted import with libsndfile
// but then get processed as desired by libmad.
// But a wav file which bears an incorrect .mp3 extension will be successfully
// processed by libsndfile and thus avoid being submitted to libmad.
if (plugin->GetPluginStringID() == wxT("libmad"))
{
// Make sure libsndfile is not already in the list
if (importPlugins.end() ==
std::find(importPlugins.begin(), importPlugins.end(), libsndfilePlugin))
{
wxLogDebug(wxT("Appending %s"),libsndfilePlugin->GetPluginStringID());
importPlugins.push_back(libsndfilePlugin);
}
}
wxLogDebug(wxT("Appending %s"),plugin->GetPluginStringID());
importPlugins.push_back(plugin);
}
@ -607,8 +589,6 @@ bool Importer::Import( AudacityProject &project,
// end of the preference list importPlugins, where it will claim success importing FFmpeg file
// formats unsuitable for it, and produce distorted results.
for (const auto &plugin : sImportPluginList())
{
if (!(plugin->GetPluginStringID() == wxT("libmad")))
{
// Make sure its not already in the list
if (importPlugins.end() ==
@ -618,7 +598,6 @@ bool Importer::Import( AudacityProject &project,
importPlugins.push_back(plugin);
}
}
}
// Try the import plugins, in the permuted sequences just determined
for (const auto plugin : importPlugins)

File diff suppressed because it is too large Load Diff