[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdesupport/taglib
From: Lukáš Lalinský <lalinsky () gmail ! com>
Date: 2009-12-14 18:42:41
Message-ID: 1260816161.128842.10019.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1062426 by lalinsky:
Be more paranoid about checking MP4 files
To consider something a valid MP4 file, it must have a 'moov' atom. Otherwise
it's marked as invalid and we won't try to read/write tags.
CCBUG:216819
M +7 -0 taglib/mp4/mp4file.cpp
M +9 -0 tests/test_mp4.cpp
--- trunk/kdesupport/taglib/taglib/mp4/mp4file.cpp #1062425:1062426
@@ -113,6 +113,13 @@
return;
}
+ // must have a moov atom, otherwise consider it invalid
+ MP4::Atom *moov = d->atoms->find("moov");
+ if(!moov) {
+ setValid(false);
+ return;
+ }
+
d->tag = new Tag(this, d->atoms);
if(readProperties) {
d->properties = new Properties(this, d->atoms, audioPropertiesStyle);
--- trunk/kdesupport/taglib/tests/test_mp4.cpp #1062425:1062426
@@ -16,6 +16,7 @@
CPPUNIT_TEST_SUITE(TestMP4);
CPPUNIT_TEST(testProperties);
CPPUNIT_TEST(testFreeForm);
+ CPPUNIT_TEST(testCheckValid);
CPPUNIT_TEST(testUpdateStco);
CPPUNIT_TEST(testSaveExisingWhenIlstIsLast);
CPPUNIT_TEST(test64BitAtom);
@@ -36,6 +37,14 @@
CPPUNIT_ASSERT_EQUAL(16, ((MP4::Properties *)f.audioProperties())->bitsPerSample());
}
+ void testCheckValid()
+ {
+ MP4::File f("data/empty.aiff");
+ CPPUNIT_ASSERT(!f.isValid());
+ MP4::File f2("data/has-tags.m4a");
+ CPPUNIT_ASSERT(f2.isValid());
+ }
+
void testUpdateStco()
{
ScopedFileCopy copy("no-tags", ".3g2");
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic