]> granicus.if.org Git - taglib/commitdiff
Don't assume TDRC is an instance of TextIdentificationFrame (#831)
authorStephen F. Booth <me@sbooth.org>
Sat, 30 Sep 2017 15:15:41 +0000 (10:15 -0500)
committerGitHub <noreply@github.com>
Sat, 30 Sep 2017 15:15:41 +0000 (10:15 -0500)
If TDRC is encrypted, FrameFactory::createFrame() returns UnknownFrame
which causes problems in rebuildAggregateFrames() when it is assumed
that TDRC is a TextIdentificationFrame

taglib/mpeg/id3v2/id3v2framefactory.cpp

index 759a9b7be6737da28f933fa19c17f706f21e22f2..9347ab86972a32ea31229dfd719f8a4f0cd84947 100644 (file)
@@ -334,10 +334,11 @@ void FrameFactory::rebuildAggregateFrames(ID3v2::Tag *tag) const
      tag->frameList("TDAT").size() == 1)
   {
     TextIdentificationFrame *tdrc =
-      static_cast<TextIdentificationFrame *>(tag->frameList("TDRC").front());
+      dynamic_cast<TextIdentificationFrame *>(tag->frameList("TDRC").front());
     UnknownFrame *tdat = static_cast<UnknownFrame *>(tag->frameList("TDAT").front());
 
-    if(tdrc->fieldList().size() == 1 &&
+    if(tdrc &&
+       tdrc->fieldList().size() == 1 &&
        tdrc->fieldList().front().size() == 4 &&
        tdat->data().size() >= 5)
     {