[FFmpeg-cvslog] avformat/matroskaenc: Check codecdelay before use
Michael Niedermayer
git at videolan.org
Fri Jan 15 17:51:08 CET 2016
ffmpeg | branch: release/2.5 | Michael Niedermayer <michael at niedermayer.cc> | Wed Dec 9 16:16:46 2015 +0100| [65e7ad746fab4320235a04a8ba274ed40bcafa95] | committer: Michael Niedermayer
avformat/matroskaenc: Check codecdelay before use
Fixes CID1238790
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit e6971db12b8ae49712b77378fa8141de4904082b)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=65e7ad746fab4320235a04a8ba274ed40bcafa95
---
libavformat/matroskaenc.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index fe81e11..ee90c31 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -881,14 +881,18 @@ static int mkv_write_track(AVFormatContext *s, MatroskaMuxContext *mkv,
}
if (codec->codec_type == AVMEDIA_TYPE_AUDIO && codec->initial_padding && codec->codec_id == AV_CODEC_ID_OPUS) {
+ int64_t codecdelay = av_rescale_q(codec->initial_padding,
+ (AVRational){ 1, codec->sample_rate },
+ (AVRational){ 1, 1000000000 });
+ if (codecdelay < 0) {
+ av_log(s, AV_LOG_ERROR, "Initial padding is invalid\n");
+ return AVERROR(EINVAL);
+ }
// mkv->tracks[i].ts_offset = av_rescale_q(codec->initial_padding,
// (AVRational){ 1, codec->sample_rate },
// st->time_base);
- put_ebml_uint(pb, MATROSKA_ID_CODECDELAY,
- av_rescale_q(codec->initial_padding,
- (AVRational){ 1, codec->sample_rate },
- (AVRational){ 1, 1000000000 }));
+ put_ebml_uint(pb, MATROSKA_ID_CODECDELAY, codecdelay);
}
if (codec->codec_id == AV_CODEC_ID_OPUS) {
put_ebml_uint(pb, MATROSKA_ID_SEEKPREROLL, OPUS_SEEK_PREROLL);
More information about the ffmpeg-cvslog
mailing list