From patchwork Sat Oct 17 21:06:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: zsugabubus X-Patchwork-Id: 23051 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 D3A6A44B484 for ; Sun, 18 Oct 2020 00:07:49 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 947A168B6D3; Sun, 18 Oct 2020 00:07:49 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.cock.li (mail.cock.li [37.120.193.124]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4894868B669 for ; Sun, 18 Oct 2020 00:07:42 +0300 (EEST) Date: Sat, 17 Oct 2020 23:06:25 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=national.shitposting.agency; s=mail; t=1602968846; bh=fLUSlKAv1HJRoKKS9y+qryQzmdBbJ4ISgeoHAJetjh8=; h=Date:From:To:Subject:From; b=kf12o1rroK+d7SWCpN3Wm6VXZptGI+3s69x0oRVyPLiAq7dAS1Se/HWOUuZlVoK1r zESlmOpD/gFVDaF76xyA+Hu7GLW8IqEZgxxjBlRGIaiffYvatHehfeGUSx0/sysjn9 vOf+kcU28ilMeq7/AU5lAsjLJqfi9shMmVXWmjboHuhh/YKrnzvlY2oPJnJsFhlEwb U71vrel5H75XSil/zRN5U/YdIe1Jj8hVhSpKb+KawEdDqBH5e/3vti/vIdnR4BBLdU uJC8Qmbo0BdaNHmCdyr94u0xgbW24/B6WAqbwr7O2KzcMCViQnKx4ZngrablONvzkm mskyH2iiZRzfg== From: zsugabubus To: ffmpeg-devel@ffmpeg.org Message-ID: <20201017210625.h7thx47jqtkb5z2d@localhost> MIME-Version: 1.0 Content-Disposition: inline Subject: [FFmpeg-devel] [PATCH] avformat/format: ensure av_probe_input_buffer2() gives correct format 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" av_probe_input_buffer2() iterates until *fmt is found. If *fmt is not zeroed out beforehand, no probes will be taken because it is detected that format is already found at the beginning. In these cases method returns success with *fmt potentially containing the previous junk. Signed-off-by: zsugabubus --- libavformat/format.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/format.c b/libavformat/format.c index c47490c..7a5e846 100644 --- a/libavformat/format.c +++ b/libavformat/format.c @@ -229,6 +229,8 @@ int av_probe_input_buffer2(AVIOContext *pb, ff_const59 AVInputFormat **fmt, int score = 0; int ret2; + *fmt = NULL; + if (!max_probe_size) max_probe_size = PROBE_BUF_MAX; else if (max_probe_size < PROBE_BUF_MIN) {