Skip to content

Commit b7f0225

Browse files
authored
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.
1 parent f4117f8 commit b7f0225

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

taglib/mpeg/id3v2/frames/chapterframe.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "tbytevectorlist.h"
3131
#include "tdebug.h"
3232
#include "tpropertymap.h"
33+
#include "unknownframe.h"
3334

3435
using namespace TagLib;
3536
using namespace ID3v2;
@@ -259,7 +260,7 @@ void ChapterFrame::parseFields(const ByteVector &data)
259260
return;
260261

261262
// Checks to make sure that frame parsed correctly.
262-
if(frame->size() <= 0) {
263+
if(frame->size() <= 0 || dynamic_cast<UnknownFrame *>(frame)) {
263264
delete frame;
264265
return;
265266
}

taglib/mpeg/id3v2/frames/tableofcontentsframe.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
#include "tpropertymap.h"
3131
#include "tdebug.h"
32+
#include "unknownframe.h"
3233

3334
using namespace TagLib;
3435
using namespace ID3v2;
@@ -269,7 +270,7 @@ void TableOfContentsFrame::parseFields(const ByteVector &data)
269270
return;
270271

271272
// Checks to make sure that frame parsed correctly.
272-
if(frame->size() <= 0) {
273+
if(frame->size() <= 0 || dynamic_cast<UnknownFrame *>(frame)) {
273274
delete frame;
274275
return;
275276
}

0 commit comments

Comments
 (0)