]> git.sesse.net Git - ffmpeg/commit
avcodec/mpegvideo_enc: Replace some s->avctx by avctx
authorMichael Niedermayer <michael@niedermayer.cc>
Tue, 25 Aug 2020 19:31:57 +0000 (21:31 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Sun, 30 Aug 2020 14:18:37 +0000 (16:18 +0200)
commita0f20c3b3f197f1655a2e11c25c4f3332bc9c9a5
treeae7d719234fdb97f32b5dbc82dae29aa494f3ea9
parentff4cc8c65458eb4494a0a1a8ff136dcf85a0f4d0
avcodec/mpegvideo_enc: Replace some s->avctx by avctx

Fixes issue reported by: Xu Guangxin <guangxin.xu@intel.com>
Original report:
Steps to reproduce:
1. ./configure --enable-debug=3 --disable-libx264 && make install
2. ffmpeg -i input.mp4 -profile:v baseline output.mp4 -y

you will see a crash like this:
[mpeg4 @ 0x5555575854c0] [Eval @ 0x7fffffffbf80] Undefined constant or missing '(' in 'baseline'
[mpeg4 @ 0x5555575854c0] Unable to parse option value "baseline"
[mpeg4 @ 0x5555575854c0] Error setting option profile to value baseline.
Thread 1 "ffmpeg" received signal SIGSEGV, Segmentation fault.

root cause:
If the codec has FF_CODEC_CAP_INIT_CLEANUP flag, and avcodec_open2 got an error before avctx->codec->init,
the ff_mpv_encode_end will face a null s->avctx.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/mpegvideo_enc.c