From fa17b4da6b74624ab7451a92353c886e97c4482b Mon Sep 17 00:00:00 2001 From: Tsuda Kageyu Date: Thu, 18 Jun 2015 19:27:21 +0900 Subject: [PATCH] Avoid overwriting the audio stream when adding an ID3v1 tag to a FLAC file. --- taglib/flac/flacfile.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/taglib/flac/flacfile.cpp b/taglib/flac/flacfile.cpp index dbf0d767..4d2d69e6 100644 --- a/taglib/flac/flacfile.cpp +++ b/taglib/flac/flacfile.cpp @@ -258,8 +258,16 @@ bool FLAC::File::save() } if(ID3v1Tag()) { - seek(-128, End); + if(d->hasID3v1) { + seek(d->ID3v1Location); + } + else { + seek(0, End); + d->ID3v1Location = tell(); + } + writeBlock(ID3v1Tag()->render()); + d->hasID3v1 = true; } return true;