From b7f0225f0def07d6e7e00a2a3ca998067a8a7ba0 Mon Sep 17 00:00:00 2001 From: Urs Fleisch Date: Sun, 15 Feb 2026 08:38:14 +0100 Subject: [PATCH] Do not allow unknown frames embedded in CTOC and CHAP (#1306) This prevents the parsing of frames with specially constructed recursive frame hierarchies from taking an extremely long time. --- taglib/mpeg/id3v2/frames/chapterframe.cpp | 3 ++- taglib/mpeg/id3v2/frames/tableofcontentsframe.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/taglib/mpeg/id3v2/frames/chapterframe.cpp b/taglib/mpeg/id3v2/frames/chapterframe.cpp index 10dcc556..afe76dae 100644 --- a/taglib/mpeg/id3v2/frames/chapterframe.cpp +++ b/taglib/mpeg/id3v2/frames/chapterframe.cpp @@ -30,6 +30,7 @@ #include "tbytevectorlist.h" #include "tdebug.h" #include "tpropertymap.h" +#include "unknownframe.h" using namespace TagLib; using namespace ID3v2; @@ -259,7 +260,7 @@ void ChapterFrame::parseFields(const ByteVector &data) return; // Checks to make sure that frame parsed correctly. - if(frame->size() <= 0) { + if(frame->size() <= 0 || dynamic_cast(frame)) { delete frame; return; } diff --git a/taglib/mpeg/id3v2/frames/tableofcontentsframe.cpp b/taglib/mpeg/id3v2/frames/tableofcontentsframe.cpp index 4630c6f9..805ae849 100644 --- a/taglib/mpeg/id3v2/frames/tableofcontentsframe.cpp +++ b/taglib/mpeg/id3v2/frames/tableofcontentsframe.cpp @@ -29,6 +29,7 @@ #include "tpropertymap.h" #include "tdebug.h" +#include "unknownframe.h" using namespace TagLib; using namespace ID3v2; @@ -269,7 +270,7 @@ void TableOfContentsFrame::parseFields(const ByteVector &data) return; // Checks to make sure that frame parsed correctly. - if(frame->size() <= 0) { + if(frame->size() <= 0 || dynamic_cast(frame)) { delete frame; return; }