[id3lib-devel] Bug in ID3_Tag::Render
Brought to you by:
t1mpy
From: Valentyn P. <val...@gm...> - 2011-07-08 12:50:52
|
Hi, I'm working on a commercial project using id3lib and looks like I've found a bug in size_t ID3_Tag::Render(ID3_Writer& writer, ID3_TagType tt) const (tag.cpp, line ~654) Its code is the following: size_t ID3_Tag::Render(ID3_Writer& writer, ID3_TagType tt) const { ID3_Writer::pos_type beg = writer.getCur(); if (ID3TT_ID3V2 & tt) { id3::v2::render(writer, *this); } else if (ID3TT_ID3V1 & tt) { id3::v1::render(writer, *this); } return writer.getCur() - beg; } But both id3::v2::render() and id3::v1::render() take const ID3_TagImpl& as the second parameter. This causes creation of a temporary ID3_TagImpl with a destructor that destroys all frames owned by original ID3_Tag::_impl. I get a crash in ID3_TagImpl::~ID3_TagImpl() after trying to use ID3_Tag::Render(). I think the correct code must be the following: size_t ID3_Tag::Render(ID3_Writer& writer, ID3_TagType tt) const { ID3_Writer::pos_type beg = writer.getCur(); if (ID3TT_ID3V2 & tt) { id3::v2::render(writer, *(this->_impl)); } else if (ID3TT_ID3V1 & tt) { id3::v1::render(writer, *(this->_impl)); } return writer.getCur() - beg; } This code works fine in my case. -- Best regards, Valentyn Pavliuchenko -- Best regards, Valentyn Pavliuchenko |