diff options
author | Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> | 2015-03-18 21:57:58 +0100 |
---|---|---|
committer | Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> | 2015-05-14 19:04:33 +0200 |
commit | 763ab41f771c7d5be3912aa4a69270b53fa0d401 (patch) | |
tree | e74dea51aa71b7f25ce436692ce99d768c289be4 | |
parent | 76ee9fdb61db80339404c43039a9e3912dcb8ad9 (diff) | |
download | ffmpeg-763ab41f771c7d5be3912aa4a69270b53fa0d401.tar.gz |
mxfenc: don't try to write footer without header
This fixes a crash, when trying to mux h264 into mxf_opatom.
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Previous version reviewed-by: tomas.hardin@codemill.se
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit b61cb61ab8f9abca98cc8c4d67cbefdb30f1e82a)
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
-rw-r--r-- | libavformat/mxfenc.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c index eb608ca6d6..ac19b08a32 100644 --- a/libavformat/mxfenc.c +++ b/libavformat/mxfenc.c @@ -2265,6 +2265,13 @@ static int mxf_write_footer(AVFormatContext *s) AVIOContext *pb = s->pb; int err = 0; + if (!mxf->header_written || + (s->oformat == &ff_mxf_opatom_muxer && !mxf->body_partition_offset)) { + /* reason could be invalid options/not supported codec/out of memory */ + err = AVERROR_UNKNOWN; + goto end; + } + mxf->duration = mxf->last_indexed_edit_unit + mxf->edit_units_count; mxf_write_klv_fill(s); |