Skip to content

Commit

Permalink
flac: fix crash on corrupt metadata (CVE-2017-15371)
Browse files Browse the repository at this point in the history
  • Loading branch information
mansr committed Nov 5, 2017
1 parent 600c291 commit 818bdd0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/flac.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,18 +119,20 @@ static void decoder_metadata_callback(FLAC__StreamDecoder const * const flac, FL
p->total_samples = metadata->data.stream_info.total_samples;
}
else if (metadata->type == FLAC__METADATA_TYPE_VORBIS_COMMENT) {
const FLAC__StreamMetadata_VorbisComment *vc = &metadata->data.vorbis_comment;
size_t i;

if (metadata->data.vorbis_comment.num_comments == 0)
if (vc->num_comments == 0)
return;

if (ft->oob.comments != NULL) {
lsx_warn("multiple Vorbis comment block ignored");
return;
}

for (i = 0; i < metadata->data.vorbis_comment.num_comments; ++i)
sox_append_comment(&ft->oob.comments, (char const *) metadata->data.vorbis_comment.comments[i].entry);
for (i = 0; i < vc->num_comments; ++i)
if (vc->comments[i].entry)
sox_append_comment(&ft->oob.comments, (char const *) vc->comments[i].entry);
}
}

Expand Down

0 comments on commit 818bdd0

Please sign in to comment.