diff mbox

[FFmpeg-devel,1/1] Add null check for the frame pointer

Message ID 20180625105042.18264-1-sploving1@gmail.com
State New
Headers show

Commit Message

Baozeng Ding June 25, 2018, 10:50 a.m. UTC
Signed-off-by: Baozeng Ding <sploving1@gmail.com>

The argument `frame` for avcodec_receive_frame function is user controlled. If
a null pointer is passed from the user, it will cause a segmentation fault.
---
 libavcodec/decode.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox

Patch

diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 6a3a4df1..7df096c 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -711,6 +711,7 @@  int attribute_align_arg avcodec_receive_frame(AVCodecContext *avctx, AVFrame *fr
     AVCodecInternal *avci = avctx->internal;
     int ret;
 
+    av_assert0(frame != 0);
     av_frame_unref(frame);
 
     if (!avcodec_is_open(avctx) || !av_codec_is_decoder(avctx->codec))