From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 62C29440FD for ; Fri, 26 Aug 2022 06:45:17 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B240468B9E9; Fri, 26 Aug 2022 09:45:14 +0300 (EEST) Received: from bg5.exmail.qq.com (bg4.exmail.qq.com [43.155.67.158]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0A91068B823 for ; Fri, 26 Aug 2022 09:45:07 +0300 (EEST) X-QQ-mid: bizesmtp76t1661496301tn6jo92o Received: from localhost ( [103.107.217.224]) by bizesmtp.qq.com (ESMTP) with id ; Fri, 26 Aug 2022 14:45:00 +0800 (CST) X-QQ-SSF: 01100000000000Z0Z000000A0000000 X-QQ-FEAT: 0KJb8nNTJpMRBU0jwwOlx1HOfSgQgYcYht/bsrVyLq+yMq1hMc+I28LElNlbg /o9au//TM8l5hIpnDkQtB15EaPS/iIUN0GcyLJLD3iify9tkV98aoG4E8VHHjGo4jtReKPQ CFCCn2R2hJ7+OpsA+Qu+oI2ugtswzZDC/Q6K7WQnPzLdgxWvYCti0m7kLyd0am6Z5GBinFw Les4tcM0QR8efx3v/LuW0hXjzHTAqrX6/tlq3GgaSqOZEE6PoRtnxB/NmXsyR5WY4WRO5xs TlS527lOay82uopZthcWPZLUrgYzxv5yFMwEjHr8QqzGkMHlNIBzr16OQMEVfWo/vyJgLG9 KW8P3p2rw7lX1LZFxwYB+m+qxBkKVK3/NBQNSMn X-QQ-GoodBg: 0 From: Steven Liu To: ffmpeg-devel@ffmpeg.org Date: Fri, 26 Aug 2022 14:44:56 +0800 Message-Id: <20220826064456.92895-1-lq@chinaffmpeg.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: References: MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:chinaffmpeg.org:qybglogicsvr:qybglogicsvr2 Subject: [FFmpeg-devel] [PATCH v2] avformat/imfdec: check track valid before use it X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Steven Liu Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: fix CID: 1512414 And return AVERROR_INVALIDDATA when get_next_track_with_minimum_timestamp incorrect in imf_read_packet; Signed-off-by: Steven Liu --- libavformat/imfdec.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavformat/imfdec.c b/libavformat/imfdec.c index 5bbe7a53f8..08f342bc1a 100644 --- a/libavformat/imfdec.c +++ b/libavformat/imfdec.c @@ -697,8 +697,9 @@ static IMFVirtualTrackPlaybackCtx *get_next_track_with_minimum_timestamp(AVForma } } - av_log(s, AV_LOG_DEBUG, "Found next track to read: %d (timestamp: %lf / %lf)\n", - track->index, av_q2d(track->current_timestamp), av_q2d(minimum_timestamp)); + if (track) + av_log(s, AV_LOG_DEBUG, "Found next track to read: %d (timestamp: %lf / %lf)\n", + track->index, av_q2d(track->current_timestamp), av_q2d(minimum_timestamp)); return track; } @@ -760,6 +761,8 @@ static int imf_read_packet(AVFormatContext *s, AVPacket *pkt) AVRational next_timestamp; track = get_next_track_with_minimum_timestamp(s); + if (!track) + return AVERROR_INVALIDDATA; ret = get_resource_context_for_timestamp(s, track, &resource); if (ret) -- 2.25.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".