diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2019-10-22 15:16:42 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2019-10-24 19:45:17 +0200 |
commit | c36eae65e488d8b047d37aa157c3c3c033f6489d (patch) | |
tree | fffe5dedfac7a2ca407cd2002a4bf9f9327853ba /libavformat | |
parent | ac0f5f4c1717470c0254879cb3ac164af0d47727 (diff) | |
download | ffmpeg-c36eae65e488d8b047d37aa157c3c3c033f6489d.tar.gz |
avformat/mpeg: Add padding to extradata
Extradata is supposed to be padded with AV_INPUT_BUFFER_PADDING_SIZE bytes,
yet the VobSub demuxer used av_strdup for the allocation of extradata.
This has been changed.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/mpeg.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c index c33401f1a0..3750de65a1 100644 --- a/libavformat/mpeg.c +++ b/libavformat/mpeg.c @@ -769,7 +769,7 @@ static int vobsub_read_header(AVFormatContext *s) goto end; } - av_bprint_init(&header, 0, AV_BPRINT_SIZE_UNLIMITED); + av_bprint_init(&header, 0, INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE); while (!avio_feof(s->pb)) { char line[MAX_LINE_SIZE]; int len = ff_get_line(s->pb, line, sizeof(line)); @@ -896,14 +896,12 @@ static int vobsub_read_header(AVFormatContext *s) } av_bprint_finalize(&header, &header_str); for (i = 0; i < s->nb_streams; i++) { - AVStream *sub_st = s->streams[i]; - sub_st->codecpar->extradata = av_strdup(header_str); - if (!sub_st->codecpar->extradata) { - ret = AVERROR(ENOMEM); - sub_st->codecpar->extradata_size = 0; + AVCodecParameters *par = s->streams[i]->codecpar; + ret = ff_alloc_extradata(par, header.len); + if (ret < 0) { goto end; } - sub_st->codecpar->extradata_size = header.len; + memcpy(par->extradata, header_str, header.len); } end: |