mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-01-29 18:53:02 +00:00
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>
This commit is contained in:
parent
1dd854e10f
commit
0c800b2761
@ -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);
|
ret = avctx->codec->encode2(avctx, avpkt, frame, got_packet_ptr);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
if (*got_packet_ptr) {
|
if (*got_packet_ptr) {
|
||||||
|
Loading…
Reference in New Issue
Block a user