[FFmpeg-devel] [PATCH] avcodec: Assert on codec->encode2 in encode_audio2

lummax luogpg at googlemail.com
Thu Aug 27 12:40:30 CEST 2015


Assert on `avctx->codec->encode2` to avoid a SEGFAULT on the subsequent
function call.
---
 libavcodec/utils.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 4da16ee..f51070c 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1953,6 +1953,8 @@ int attribute_align_arg avcodec_encode_audio2(AVCodecContext *avctx,
         }
     }
 
+    av_assert0(avctx->codec->encode2);
+
     ret = avctx->codec->encode2(avctx, avpkt, frame, got_packet_ptr);
     if (!ret) {
         if (*got_packet_ptr) {
-- 
2.5.0



More information about the ffmpeg-devel mailing list