mirror of
https://github.com/taglib/taglib.git
synced 2025-05-27 21:20:26 -04:00
Skip unknown MP4 boxes (#1231)
This commit is contained in:
parent
3d4428726e
commit
f3fb4d83a4
@ -95,13 +95,6 @@ MP4::Atom::Atom(File *file)
|
||||
}
|
||||
|
||||
d->name = header.mid(4, 4);
|
||||
for(int i = 0; i < 4; ++i) {
|
||||
if(const char ch = d->name.at(i); (ch < ' ' || ch > '~') && ch != '\251') {
|
||||
debug("MP4: Invalid atom type");
|
||||
d->length = 0;
|
||||
file->seek(0, File::End);
|
||||
}
|
||||
}
|
||||
|
||||
for(auto c : containers) {
|
||||
if(d->name == c) {
|
||||
|
BIN
tests/data/nonprintable-atom-type.m4a
Normal file
BIN
tests/data/nonprintable-atom-type.m4a
Normal file
Binary file not shown.
@ -101,6 +101,7 @@ class TestMP4 : public CppUnit::TestFixture
|
||||
CPPUNIT_TEST(testRemoveMetadata);
|
||||
CPPUNIT_TEST(testNonFullMetaAtom);
|
||||
CPPUNIT_TEST(testItemFactory);
|
||||
CPPUNIT_TEST(testNonPrintableAtom);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
public:
|
||||
@ -847,6 +848,25 @@ public:
|
||||
CPPUNIT_ASSERT_EQUAL(StringList("456"), properties.value("TESTINTEGER"));
|
||||
}
|
||||
}
|
||||
|
||||
void testNonPrintableAtom()
|
||||
{
|
||||
ScopedFileCopy copy("nonprintable-atom-type", ".m4a");
|
||||
{
|
||||
MP4::File f(copy.fileName().c_str());
|
||||
CPPUNIT_ASSERT(f.isValid());
|
||||
CPPUNIT_ASSERT_EQUAL(1, f.audioProperties()->channels());
|
||||
CPPUNIT_ASSERT_EQUAL(32000, f.audioProperties()->sampleRate());
|
||||
f.tag()->setTitle("TITLE");
|
||||
f.save();
|
||||
}
|
||||
{
|
||||
MP4::File f(copy.fileName().c_str());
|
||||
CPPUNIT_ASSERT(f.isValid());
|
||||
CPPUNIT_ASSERT(f.hasMP4Tag());
|
||||
CPPUNIT_ASSERT_EQUAL(String("TITLE"), f.tag()->title());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION(TestMP4);
|
||||
|
Loading…
Reference in New Issue
Block a user