From patchwork Sun Oct 23 16:27:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Cadhalpun X-Patchwork-Id: 1142 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.140.133 with SMTP id o127csp1837167vsd; Sun, 23 Oct 2016 09:27:13 -0700 (PDT) X-Received: by 10.194.157.169 with SMTP id wn9mr8017573wjb.195.1477240033324; Sun, 23 Oct 2016 09:27:13 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id bx7si12094084wjb.195.2016.10.23.09.27.12; Sun, 23 Oct 2016 09:27:13 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@googlemail.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=QUARANTINE dis=NONE) header.from=googlemail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4F17C689CB2; Sun, 23 Oct 2016 19:27:08 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9537D689C8D for ; Sun, 23 Oct 2016 19:27:01 +0300 (EEST) Received: by mail-wm0-f68.google.com with SMTP id d199so6294414wmd.1 for ; Sun, 23 Oct 2016 09:27:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=from:subject:to:references:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=vQ9LNnBcSXES/vCPZmpilvroTqAcOF5wlQ33nwPc99s=; b=jpJlZJQgzdB2dUGppIgRM8Gp1jZkFTf4hoNQCSdJtEUFCdV2GfFMay7Ge/2gep/hUL GF/ofF49OGgLM3XgTpzAod76qasizsOvaQuQ6WzEgXj/jHUjNtf9VoYAlZ7o6UzTLqI3 GpXd1hPokDE4V3dPZH1vp7i7CmV23Z6n5laYkHi0gI6zg598qhlKu1Homzu5DOjFL4HM haEaJpRyoL2mWnZJvwNR2b5VKAwYweLTKfJYnprMx1NeEEmAo9dcDjGyo3JfgB/wUoUc dQMYNdZ+H6FbG5V4PcLjrhE7cj1kdZrX2u6e5w2GLaMGMKZ3t5Uzo48M0JJqe14Sq+iq Vkfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:subject:to:references:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=vQ9LNnBcSXES/vCPZmpilvroTqAcOF5wlQ33nwPc99s=; b=DwrJjNDIEZ4gPnyyWFInWXJ/xwb5l92WvJGA41vbCLpMrrI6jKPfSpxeY1qYGaYl0f zHlyRWueDaB4dvp9g5U/IgscMW3Z4H3W6k6Vh5Hf9FwdwjMa3XFWzxUATRhX2Bskc3gj FT3QEO+4tZX4oJ0mI0SCDH/lY1EFr+R9H6Pa+dCP4Egjd+fOrXkpAZ8/ctALeyPDbwbf dOse+TzuuoxjmjJkD0Er3PEKxq8o+u4eUwPtgjw6yJdNvHn79OabwQ0YRFLWEM/bpgqK V/KysjEab3btkMqc2yMPZppDclYFdS2kLTr2TIywJU4wVrDKZbM60iiLOa0SsxfDTz0B Oggg== X-Gm-Message-State: ABUngvcmyC1nos1D0U7ltnv3TOCUByv+Xx6Z8K6jKWjH0jZUZQJnWW/su4ihwJ8nnd8rkg== X-Received: by 10.194.104.232 with SMTP id gh8mr8361850wjb.49.1477240024370; Sun, 23 Oct 2016 09:27:04 -0700 (PDT) Received: from [192.168.2.21] (p5B095E5A.dip0.t-ipconnect.de. [91.9.94.90]) by smtp.googlemail.com with ESMTPSA id c4sm10027688wmh.4.2016.10.23.09.27.03 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 23 Oct 2016 09:27:03 -0700 (PDT) From: Andreas Cadhalpun X-Google-Original-From: Andreas Cadhalpun To: FFmpeg development discussions and patches References: <6622a3c7-3900-8982-1179-4ccdd0fec2b3@googlemail.com> Message-ID: <143bf909-8ad3-c567-84d2-3e8d8f09443c@googlemail.com> Date: Sun, 23 Oct 2016 18:27:02 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.4.0 MIME-Version: 1.0 In-Reply-To: <6622a3c7-3900-8982-1179-4ccdd0fec2b3@googlemail.com> Subject: [FFmpeg-devel] [PATCH 02/12] bfi: validate sample_rate 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" A negative sample rate doesn't make sense and triggers assertions in av_rescale_rnd. Signed-off-by: Andreas Cadhalpun --- libavformat/bfi.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavformat/bfi.c b/libavformat/bfi.c index 568363d..ef4c17d 100644 --- a/libavformat/bfi.c +++ b/libavformat/bfi.c @@ -88,6 +88,10 @@ static int bfi_read_header(AVFormatContext * s) vstream->codecpar->extradata_size); astream->codecpar->sample_rate = avio_rl32(pb); + if (astream->codecpar->sample_rate <= 0) { + av_log(s, AV_LOG_ERROR, "Invalid sample rate %d\n", astream->codecpar->sample_rate); + return AVERROR_INVALIDDATA; + } /* Set up the video codec... */ avpriv_set_pts_info(vstream, 32, 1, fps);