Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlummax <luogpg@googlemail.com>2015-08-27 13:40:30 +0300
committerMichael Niedermayer <michael@niedermayer.cc>2015-08-27 18:26:24 +0300
commit0c800b27611cadd64f46fd1bbd9dc8bb87fe168b (patch)
tree7c72f5f8dafe7498e29ea2433db22c349c073bb6 /libavcodec/utils.c
parent1dd854e10fe19d3a9cee38f886f66707c082c132 (diff)
avcodec: Assert on codec->encode2 in encode_audio2
Assert on `avctx->codec->encode2` to avoid a SEGFAULT on the subsequent function call. avcodec_encode_video2() uses a similar assertion. Calling the wrong function on a stream is a serious inconsistency which could at other places be potentially dangerous and exploitable, it is thus safer to stop execution and not continue with such inconsistency after returning an error. Commit-message-extended-by commiter Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r--libavcodec/utils.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 4da16eeb54..f51070c5bc 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) {