Check ID3v2 tag size before parsing whole tags in a file

Martin Flaska mflaska at nuvotechnologies.com
Tue Oct 29 16:25:29 UTC 2013


Hello,

is there any way to check ID3v2 tag size before parsing such file?

The problem I am trying to solve/avoid is that when I am parsing MP3 
with ID3 tag size more than ~15 MiB we run out of resources and oom 
killer terminate process which is parsing MP3 files.

So as the first hot fix I need do probably only this before doing any 
other related fixes which could take longer time.
(Or use another method for parsing which does not consume so much memory)

Our code is like this:


TagLib::MPEG::File file(fpath, TagLib::ID3v2::FrameFactory::instance());

if (file.isValid()) {
	duration = file.audioProperties()->length();

	TagLib::ID3v2::Tag *id3v2tag = file.ID3v2Tag();
...


Regards.

Martin



More information about the taglib-devel mailing list