Possible bug in MPEG::File::strip

Kevin André hyperquantum at gmail.com
Thu Sep 15 15:10:35 UTC 2016


On Tue, Sep 13, 2016 at 5:57 PM, Kevin André <hyperquantum at gmail.com> wrote:
> I think I found a problem in MPEG::File::strip, and I managed to
> reproduce it with a new unit test (see patch attached).
(...)
> The result of (4) is exactly 128 bytes larger than the result of (2).
> And that is the size of an ID3v1 tag. So, is there something wrong
> with the strip() method? Or did I miss something?

I found the cause of this problem and submitted a pull request (#754)
with a fix.

When looking for the presence of an ID3v1 tag, TagLib does this:

file->seek(-128, File::End);

But the implementation of seek in ByteVectorStream was wrong in case
the second argument was IOStream::End.
Any ID3v1 tag present would never be found because of this. So strip()
would not remove the tag because it did not even know it was there.

Interestingly, this bug only manifested itself when using a
ByteVectorStream as input, not when using a FileStream. I guess I must
be the only one using TagLib without a FileStream :-)

One more question: should the unit test I submitted as a patch in my
previous e-mail also be added to the official test suite of TagLib, or
is it not considered relevant enough for the project?


Regards,

Kevin


More information about the taglib-devel mailing list