weixin_39771987 2020-11-22 00:37
浏览 0

FLAC::File::save() has several bugs.

(Related to #612)

FLAC::File::save() may write duplicate ID3v2 tags any number of times. For example:


  void testSaveTags()
  {
    ScopedFileCopy copy("no-tags", ".flac");

    FLAC::File f(copy.fileName().c_str());
    f.ID3v2Tag(true)->setTitle("0123456789");
    f.save();
    f.save();

    // ID3v2 tag has been written twice, and overwritten by metadata blocks.
    // As a result, FLAC stream header has gone.
  }

I already found a way to fix it. But it may interfere with #557, so I will fix it after it will be merged.

该提问来源于开源项目:taglib/taglib

  • 写回答

5条回答 默认 最新

  • weixin_39771987 2020-11-22 00:37
    关注

    Gosh! It can never update an exiting ID3v2 tag.

    
      void testSaveTags()
      {
        ScopedFileCopy copy("no-tags", ".flac");
    
        {
          FLAC::File f(copy.fileName().c_str());
          f.ID3v2Tag(true)->setTitle("0123456789");
          f.save();
        }
    
        {
          FLAC::File f(copy.fileName().c_str());
          f.ID3v2Tag()->setTitle("ABCDEFGHIJ");
          f.save();
        }
    
        {
          FLAC::File f(copy.fileName().c_str());
          CPPUNIT_ASSERT_EQUAL(String("ABCDEFGHIJ"), f.ID3v2Tag()->title());
    
          // Failed. Title is still "0123456789".
        }
      }
    

    due to this check always true.

    
      if(d->ID3v2Location < d->flacStart)
        debug("FLAC::File::save() -- This can't be right -- an ID3v2 tag after the "
              "start of the FLAC bytestream?  Not writing the ID3v2 tag.");
    

    Maybe, it demonstrates how few people use an ID3v2 with a FLAC file.

    评论

报告相同问题?