From patchwork Fri May 22 05:41:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: rcombs X-Patchwork-Id: 19803 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 645BF4400F8 for ; Fri, 22 May 2020 08:42:25 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4F43D68AD77; Fri, 22 May 2020 08:42:25 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from so254-54.mailgun.net (so254-54.mailgun.net [198.61.254.54]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 90C8C6818DB for ; Fri, 22 May 2020 08:42:18 +0300 (EEST) DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=rcombs.me; q=dns/txt; s=mx; t=1590126140; h=Content-Transfer-Encoding: MIME-Version: Message-Id: Date: Subject: To: From: Sender; bh=TKj+w5jANUP523zRLLLKO9iH1UMpO63xODo/30W1ao4=; b=eGmEj9l7O/9RLiC2HTJkJPSRmWAkB8744fbcGsyDsN+dJx5PVEMI41B+aOTpHUUSQGwnjPwR vk+6Qpds8Z/aagLsEfEWDnhc5NcB0eyA4UXMLc0qCaCQG1EXzzgtsmNEqfSlwK/VzcDZiWCC ry4KyzaFXbsFQVyNpz+W86vqgwk= X-Mailgun-Sending-Ip: 198.61.254.54 X-Mailgun-Sid: WyJiZDU1MSIsICJmZm1wZWctZGV2ZWxAZmZtcGVnLm9yZyIsICJiMGJhIl0= Received: from rcombs-mbp.localdomain ( [24.14.135.13]) by smtp-out-n01.prod.us-east-1.postgun.com with SMTP id 5ec7662e8075f6e58cac8b5a (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Fri, 22 May 2020 05:42:06 GMT From: rcombs To: ffmpeg-devel@ffmpeg.org Date: Fri, 22 May 2020 00:41:58 -0500 Message-Id: <20200522054200.74203-1-rcombs@rcombs.me> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/3] lavf/format: handle max probe buffer sizes <2048 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" This can be useful in chained demuxers, where the header size is known. --- libavformat/format.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/libavformat/format.c b/libavformat/format.c index c47490c8eb..7309b0019b 100644 --- a/libavformat/format.c +++ b/libavformat/format.c @@ -231,11 +231,6 @@ int av_probe_input_buffer2(AVIOContext *pb, ff_const59 AVInputFormat **fmt, if (!max_probe_size) max_probe_size = PROBE_BUF_MAX; - else if (max_probe_size < PROBE_BUF_MIN) { - av_log(logctx, AV_LOG_ERROR, - "Specified probe size value %u cannot be < %u\n", max_probe_size, PROBE_BUF_MIN); - return AVERROR(EINVAL); - } if (offset >= max_probe_size) return AVERROR(EINVAL); @@ -251,7 +246,7 @@ int av_probe_input_buffer2(AVIOContext *pb, ff_const59 AVInputFormat **fmt, } } - for (probe_size = PROBE_BUF_MIN; probe_size <= max_probe_size && !*fmt; + for (probe_size = FFMIN(PROBE_BUF_MIN, max_probe_size); probe_size <= max_probe_size && !*fmt; probe_size = FFMIN(probe_size << 1, FFMAX(max_probe_size, probe_size + 1))) { score = probe_size < max_probe_size ? AVPROBE_SCORE_RETRY : 0;