Skip to content

Commit b4a4b42

Browse files
StefanBruensufleisch
authored andcommitted
Avoid corrupting an (invalid) FLAC Ogg file without Vorbis comment
FLAC in Ogg must have a Vorbis comment Metadata block, but in case the file still has none avoid overwriting the first packet, i.e. the Streaminfo Metadata block.
1 parent 70c6a0c commit b4a4b42

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

taglib/ogg/flac/oggflacfile.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,11 @@ Properties *Ogg::FLAC::File::audioProperties() const
107107

108108
bool Ogg::FLAC::File::save()
109109
{
110+
if (d->commentPacket == 0) {
111+
debug("Ogg::FLAC::File::save() -- Invalid, file has no Vorbis comment metadata block.");
112+
return false;
113+
}
114+
110115
d->xiphCommentData = d->comment->render(false);
111116

112117
// Create FLAC metadata-block:

0 commit comments

Comments
 (0)