From patchwork Mon Jan 18 06:22:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Liu X-Patchwork-Id: 25005 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id C72F44491C6 for ; Mon, 18 Jan 2021 08:22:35 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9659368079F; Mon, 18 Jan 2021 08:22:35 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from smtpproxy21.qq.com (smtpbg704.qq.com [203.205.195.105]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0C9D2680109 for ; Mon, 18 Jan 2021 08:22:28 +0200 (EET) X-QQ-mid: bizesmtp17t1610950930tynuam1j Received: from localhost (unknown [103.107.216.232]) by esmtp6.qq.com (ESMTP) with id ; Mon, 18 Jan 2021 14:22:09 +0800 (CST) X-QQ-SSF: 01100000002000Z0Z000B00A0020000 X-QQ-FEAT: n4FWwWpTo56Vq4O7F1+dc3Qtv2s+DLUmRqCAlZWxOSWRNLsWczQssvLFsMviC 0n1ZaTgDawOHfFCwKJe5PheHbPDwIs01WLpAegZqRs5lze0/Vsqh6dVhAOXChTlcgZJ+nO9 HgHjXn4whmB2Onvcpm1TPq3z3sjgqG4dq+9A4b+AqHCVqgWQYCWAwrutjz1EB9/iQUJqDIj M5EOjj78RV8J4NoSbuOZ2UaIX5oiiXhewQrGk4e4F298t4/DMg2nPepT/mOt9ahpQU71TID Wn5cOIlUXaDo2bVDaXhgmGERNzARZ8qhUiU+o/Vp9EHtwth3zxbgrwUtc= X-QQ-GoodBg: 0 X-QQ-CSender: lq@chinaffmpeg.org From: liuqi05 To: ffmpeg-devel@ffmpeg.org Date: Mon, 18 Jan 2021 14:22:07 +0800 Message-Id: <20210118062208.85568-1-liuqi05@kuaishou.com> X-Mailer: git-send-email 2.25.0 MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:chinaffmpeg.org:qybgforeign:qybgforeign7 X-QQ-Bgrelay: 1 Subject: [FFmpeg-devel] [PATCH v2 1/2] avformat/dashdec: check init_section before use it. X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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: liuqi05 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" because there have no Initialization in SegmentTemplate, so it will have no init_section for init segment file. but in the is_common_init_section_exist function it will be used for check to url, url_offset and size, so check init_section before use init_section. And fix code style in is_common_init_section_exist, make the code block short when it too long. fix ticket: 9062 Signed-off-by: liuqi05 --- libavformat/dashdec.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c index 693fc7372b..9262e9c0a4 100644 --- a/libavformat/dashdec.c +++ b/libavformat/dashdec.c @@ -1992,7 +1992,12 @@ static int is_common_init_section_exist(struct representation **pls, int n_pls) url_offset = first_init_section->url_offset; size = pls[0]->init_section->size; for (i=0;iinit_section->url,url) || pls[i]->init_section->url_offset != url_offset || pls[i]->init_section->size != size) { + if (!pls[i]->init_section) + continue; + + if (av_strcasecmp(pls[i]->init_section->url, url) || + pls[i]->init_section->url_offset != url_offset || + pls[i]->init_section->size != size) { return 0; } }