]> granicus.if.org Git - taglib/commitdiff
ID3 frame IDs with 0 should be recognized as valid
authorLukáš Lalinský <lalinsky@gmail.com>
Fri, 17 Aug 2012 05:50:48 +0000 (07:50 +0200)
committerLukáš Lalinský <lalinsky@gmail.com>
Fri, 17 Aug 2012 05:50:48 +0000 (07:50 +0200)
http://article.gmane.org/gmane.comp.kde.devel.taglib/2275

taglib/mpeg/id3v2/id3v2frame.cpp
taglib/mpeg/id3v2/id3v2framefactory.cpp
tests/data/w000.mp3 [new file with mode: 0644]
tests/test_id3v2.cpp

index 3a5463f52e7ff768f035af7cd1e4bd65d1543503..9c9c640c6afcb2a6d292f97c3f8754a0dbcb67e1 100644 (file)
@@ -71,7 +71,7 @@ namespace
       return false;
 
     for(ByteVector::ConstIterator it = frameID.begin(); it != frameID.end(); it++) {
-      if( (*it < 'A' || *it > 'Z') && (*it < '1' || *it > '9') ) {
+      if( (*it < 'A' || *it > 'Z') && (*it < '0' || *it > '9') ) {
         return false;
       }
     }
index 38f46c5657c632108cd5677645c1906ed499f6ec..bcf69e1aea833abb793489df2f36b3328ad948af 100644 (file)
@@ -107,7 +107,7 @@ Frame *FrameFactory::createFrame(const ByteVector &origData, Header *tagHeader)
   }
 
   for(ByteVector::ConstIterator it = frameID.begin(); it != frameID.end(); it++) {
-    if( (*it < 'A' || *it > 'Z') && (*it < '1' || *it > '9') ) {
+    if( (*it < 'A' || *it > 'Z') && (*it < '0' || *it > '9') ) {
       delete header;
       return 0;
     }
diff --git a/tests/data/w000.mp3 b/tests/data/w000.mp3
new file mode 100644 (file)
index 0000000..f9c2261
Binary files /dev/null and b/tests/data/w000.mp3 differ
index 275336555b0ce0f572e41f021e136c054f4a927d..9cf2e50e98ee35717b5b3d9e36b6ed0f809ae01b 100644 (file)
@@ -69,6 +69,7 @@ class TestID3v2 : public CppUnit::TestFixture
   CPPUNIT_TEST(testDowngradeTo23);
   // CPPUNIT_TEST(testUpdateFullDate22); TODO TYE+TDA should be upgraded to TDRC together
   CPPUNIT_TEST(testCompressedFrameWithBrokenLength);
+  CPPUNIT_TEST(testW000);
   CPPUNIT_TEST(testPropertyInterface);
   CPPUNIT_TEST(testPropertyInterface2);
   CPPUNIT_TEST(testSaveAndStripID3v1ShouldNotAddFrameFromID3v1ToId3v2);
@@ -552,6 +553,16 @@ public:
     CPPUNIT_ASSERT_EQUAL(TagLib::uint(86414), frame->picture().size());
   }
 
+  void testW000()
+  {
+    MPEG::File f(TEST_FILE_PATH_C("w000.mp3"), false);
+    CPPUNIT_ASSERT(f.ID3v2Tag()->frameListMap().contains("W000"));
+    ID3v2::UrlLinkFrame *frame =
+        dynamic_cast<TagLib::ID3v2::UrlLinkFrame*>(f.ID3v2Tag()->frameListMap()["W000"].front());
+    CPPUNIT_ASSERT(frame);
+    CPPUNIT_ASSERT_EQUAL(String("lukas.lalinsky@example.com____"), frame->url());
+  }
+
   void testPropertyInterface()
   {
     ScopedFileCopy copy("rare_frames", ".mp3");