diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-01-01 01:58:23 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2020-02-05 17:41:59 +0100 |
commit | b4f300f8ea209b861865ef495b298a88b48f3913 (patch) | |
tree | 6561b1de63a0e8c6aecca186d740eee059ea1906 | |
parent | e934194b6a4159b7960cabefb0dd8b998c1961e8 (diff) | |
download | ffmpeg-b4f300f8ea209b861865ef495b298a88b48f3913.tar.gz |
avformat/matroskaenc: Check functions that can fail
Sometimes it has not been checked whether opening the dynamic buffer for
writing Tags fails; this might have led to segfaults.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavformat/matroskaenc.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index eec07d1ffd..42f21eae8b 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -1559,7 +1559,9 @@ static int mkv_write_tag_targets(AVFormatContext *s, uint32_t elementid, ret = mkv_add_seekhead_entry(mkv->seekhead, MATROSKA_ID_TAGS, avio_tell(s->pb)); if (ret < 0) return ret; - start_ebml_master_crc32(s->pb, &mkv->tags_bc, mkv, MATROSKA_ID_TAGS); + ret = start_ebml_master_crc32(s->pb, &mkv->tags_bc, mkv, MATROSKA_ID_TAGS); + if (ret < 0) + return ret; } pb = mkv->tags_bc; @@ -1655,7 +1657,10 @@ static int mkv_write_tags(AVFormatContext *s) if (st->codecpar->codec_type == AVMEDIA_TYPE_ATTACHMENT) continue; - mkv_write_tag_targets(s, MATROSKA_ID_TAGTARGETS_TRACKUID, i + 1, &tag_target); + ret = mkv_write_tag_targets(s, MATROSKA_ID_TAGTARGETS_TRACKUID, + i + 1, &tag_target); + if (ret < 0) + return ret; pb = mkv->tags_bc; tag = start_ebml_master(pb, MATROSKA_ID_SIMPLETAG, 0); |