diff --git a/NEWS b/NEWS index 7509d4e2..2defc51a 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,7 @@ TagLib 1.11 (Mar 4, 2016) ========================= * Fixed reading APE items with long keys. + * Fixed reading ID3v2 SYLT frames when description is empty. 1.11 BETA 2: diff --git a/taglib/mpeg/id3v2/frames/synchronizedlyricsframe.cpp b/taglib/mpeg/id3v2/frames/synchronizedlyricsframe.cpp index 4fb2e15a..c3b50c7e 100644 --- a/taglib/mpeg/id3v2/frames/synchronizedlyricsframe.cpp +++ b/taglib/mpeg/id3v2/frames/synchronizedlyricsframe.cpp @@ -158,7 +158,7 @@ void SynchronizedLyricsFrame::parseFields(const ByteVector &data) int pos = 6; d->description = readStringField(data, d->textEncoding, &pos); - if(d->description.isEmpty()) + if(pos == 6) return; /* diff --git a/tests/test_id3v2.cpp b/tests/test_id3v2.cpp index a560658b..d5ba9f29 100644 --- a/tests/test_id3v2.cpp +++ b/tests/test_id3v2.cpp @@ -94,6 +94,7 @@ class TestID3v2 : public CppUnit::TestFixture CPPUNIT_TEST(testParseOwnershipFrame); CPPUNIT_TEST(testRenderOwnershipFrame); CPPUNIT_TEST(testParseSynchronizedLyricsFrame); + CPPUNIT_TEST(testParseSynchronizedLyricsFrameWithEmptyDescritpion); CPPUNIT_TEST(testRenderSynchronizedLyricsFrame); CPPUNIT_TEST(testParseEventTimingCodesFrame); CPPUNIT_TEST(testRenderEventTimingCodesFrame); @@ -527,6 +528,35 @@ public: CPPUNIT_ASSERT_EQUAL((unsigned int)4567, stl[1].time); } + void testParseSynchronizedLyricsFrameWithEmptyDescritpion() + { + ID3v2::SynchronizedLyricsFrame f( + ByteVector("SYLT" // Frame ID + "\x00\x00\x00\x21" // Frame size + "\x00\x00" // Frame flags + "\x00" // Text encoding + "eng" // Language + "\x02" // Time stamp format + "\x01" // Content type + "\x00" // Content descriptor + "Example\x00" // 1st text + "\x00\x00\x04\xd2" // 1st time stamp + "Lyrics\x00" // 2nd text + "\x00\x00\x11\xd7", 40)); // 2nd time stamp + CPPUNIT_ASSERT_EQUAL(String::Latin1, f.textEncoding()); + CPPUNIT_ASSERT_EQUAL(ByteVector("eng", 3), f.language()); + CPPUNIT_ASSERT_EQUAL(ID3v2::SynchronizedLyricsFrame::AbsoluteMilliseconds, + f.timestampFormat()); + CPPUNIT_ASSERT_EQUAL(ID3v2::SynchronizedLyricsFrame::Lyrics, f.type()); + CPPUNIT_ASSERT(f.description().isEmpty()); + ID3v2::SynchronizedLyricsFrame::SynchedTextList stl = f.synchedText(); + CPPUNIT_ASSERT_EQUAL((unsigned int)2, stl.size()); + CPPUNIT_ASSERT_EQUAL(String("Example"), stl[0].text); + CPPUNIT_ASSERT_EQUAL((unsigned int)1234, stl[0].time); + CPPUNIT_ASSERT_EQUAL(String("Lyrics"), stl[1].text); + CPPUNIT_ASSERT_EQUAL((unsigned int)4567, stl[1].time); + } + void testRenderSynchronizedLyricsFrame() { ID3v2::SynchronizedLyricsFrame f;