Commit 40a7700b authored by Michael Niedermayer's avatar Michael Niedermayer

avformat/flacenc: Check length in flac_write_block_comment()

Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent eca38864
...@@ -50,12 +50,14 @@ static int flac_write_block_comment(AVIOContext *pb, AVDictionary **m, ...@@ -50,12 +50,14 @@ static int flac_write_block_comment(AVIOContext *pb, AVDictionary **m,
int last_block, int bitexact) int last_block, int bitexact)
{ {
const char *vendor = bitexact ? "ffmpeg" : LIBAVFORMAT_IDENT; const char *vendor = bitexact ? "ffmpeg" : LIBAVFORMAT_IDENT;
unsigned int len; int64_t len;
uint8_t *p, *p0; uint8_t *p, *p0;
ff_metadata_conv(m, ff_vorbiscomment_metadata_conv, NULL); ff_metadata_conv(m, ff_vorbiscomment_metadata_conv, NULL);
len = ff_vorbiscomment_length(*m, vendor); len = ff_vorbiscomment_length(*m, vendor);
if (len >= ((1<<24) - 4))
return AVERROR(EINVAL);
p0 = av_malloc(len+4); p0 = av_malloc(len+4);
if (!p0) if (!p0)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
......
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