From c8875a2db954dbbacab8c1fc2d49321a5a6e0511 Mon Sep 17 00:00:00 2001 From: Johnson Ding Date: Fri, 4 Jan 2019 17:32:44 +0800 Subject: [PATCH] [mpp]: avoid crash when dumping a frame whose fd is -1 Change-Id: I6c7252ac32a4b857a79a4203fdaa56a2f0443645 Signed-off-by: Johnson Ding --- mpp/mpp_impl.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mpp/mpp_impl.cpp b/mpp/mpp_impl.cpp index def84110..1238ccb0 100644 --- a/mpp/mpp_impl.cpp +++ b/mpp/mpp_impl.cpp @@ -324,6 +324,11 @@ MPP_RET mpp_ops_dec_get_frm(MppDump info, MppFrame frame) info_change, error, discard, mpp_frame_get_pts(frame)); } + if (NULL == buf || fd < 0) { + mpp_err("failed to dump frame\n"); + return MPP_NOK; + } + dump_frame(p->fp_out, frame, p->fp_buf, p->dump_width, p->dump_height); if (p->debug & MPP_DBG_DUMP_LOG) {