Commit 66f26b3e authored by Michael Niedermayer's avatar Michael Niedermayer

avformat/matroskaenc: Check ff_vorbiscomment_length in put_flac_codecpriv()

Its currently guaranteed to be smaller but its safer to check anyway
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 0db5b2b9
...@@ -546,12 +546,15 @@ static int put_flac_codecpriv(AVFormatContext *s, ...@@ -546,12 +546,15 @@ static int put_flac_codecpriv(AVFormatContext *s,
"Lavf" : LIBAVFORMAT_IDENT; "Lavf" : LIBAVFORMAT_IDENT;
AVDictionary *dict = NULL; AVDictionary *dict = NULL;
uint8_t buf[32], *data, *p; uint8_t buf[32], *data, *p;
int len; int64_t len;
snprintf(buf, sizeof(buf), "0x%"PRIx64, codec->channel_layout); snprintf(buf, sizeof(buf), "0x%"PRIx64, codec->channel_layout);
av_dict_set(&dict, "WAVEFORMATEXTENSIBLE_CHANNEL_MASK", buf, 0); av_dict_set(&dict, "WAVEFORMATEXTENSIBLE_CHANNEL_MASK", buf, 0);
len = ff_vorbiscomment_length(dict, vendor); len = ff_vorbiscomment_length(dict, vendor);
if (len >= ((1<<24) - 4))
return AVERROR(EINVAL);
data = av_malloc(len + 4); data = av_malloc(len + 4);
if (!data) { if (!data) {
av_dict_free(&dict); av_dict_free(&dict);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment