From patchwork Sun Oct 23 16:30:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Cadhalpun X-Patchwork-Id: 1148 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.140.133 with SMTP id o127csp1838232vsd; Sun, 23 Oct 2016 09:30:59 -0700 (PDT) X-Received: by 10.194.107.137 with SMTP id hc9mr9739710wjb.158.1477240259314; Sun, 23 Oct 2016 09:30:59 -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 9si8068018wmr.69.2016.10.23.09.30.58; Sun, 23 Oct 2016 09:30:59 -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 C9DC6689CFB; Sun, 23 Oct 2016 19:30:53 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 69D4A689CD7 for ; Sun, 23 Oct 2016 19:30:47 +0300 (EEST) Received: by mail-wm0-f66.google.com with SMTP id o81so6277384wma.2 for ; Sun, 23 Oct 2016 09:30:50 -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=4inIJHylqDkPRhIbiCNvdrCYMqWHZbBBGi8OoFGK6CM=; b=bxF8LJlpNs3z2MUASvjstNnnKtLBIbNxyKOwiKMef4Nxa/0RjFsYPvvAZ9U50q7MTz wD2aeFOFo7sO4oNokQMR+vFti3kdIqJNPdkUAWkpNtKT97Vzpi6qB1ndoFLUCXOGs15q tqlrG/ZxJXQr31La2KkJwBo3oyAtvr+V7IJtrNoFoJzRqI/LHcTZ6yTUpGPbwzOBDTsZ Kbml4Onn7cU0H7JL05r1fMX63MczvQMRvgkjZU4YYZdWcz+LAyrpsC3OC8mnB7u0e37A GeCP9/s1oFPgM0IA1oPaKrpxhJ2Z0rDNLVLzVoG6yG0xlsJcD/qgzk8TYujQOh7oDjjI 0U4w== 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=4inIJHylqDkPRhIbiCNvdrCYMqWHZbBBGi8OoFGK6CM=; b=PVIZC67PNHvIsnWMT81I4qeQ27vFLlH492Nfj7N8IP/r8QAcInweRbOPnpeNT7ybiy O5vs7bYRpHxQyabKZMt1qv/0NcVlnmPatRYrDSbWt5qs301wohrJakfmMFPfrAocgiLs p4RytMdesNjlZziuZcjkxOg2kWeBbbLIiQsyZACFDIcxRVcLGi4DFS6mFNpnA6a1qm/U i627t6TpuwOdlLr+6f8utAtfjoeSNrMHgNjQPvUxRtFmFZkFshXhhIjgqHy/gnUEP+9v ckF2atf3kp0dKY11TQvV2I4WWwukI5dbJbrQ7aKCOFVbpLuJoaFu/BGxcoKIoqK0XL10 nmBw== X-Gm-Message-State: ABUngvdaE37DfHYW54NWd+TRSEBSrOInX/AmKvB5C75K27C+RdKrU0/MejUQEPP6MmYweA== X-Received: by 10.28.175.2 with SMTP id y2mr11837230wme.106.1477240250124; Sun, 23 Oct 2016 09:30:50 -0700 (PDT) Received: from [192.168.2.21] (p5B095E5A.dip0.t-ipconnect.de. [91.9.94.90]) by smtp.googlemail.com with ESMTPSA id p13sm10005377wmd.20.2016.10.23.09.30.49 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 23 Oct 2016 09:30:49 -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: <6ef771ac-2ae1-480c-f655-236d5819fced@googlemail.com> Date: Sun, 23 Oct 2016 18:30:49 +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 10/12] oggparsespeex: 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/oggparsespeex.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavformat/oggparsespeex.c b/libavformat/oggparsespeex.c index 434b0fd..2b49150 100644 --- a/libavformat/oggparsespeex.c +++ b/libavformat/oggparsespeex.c @@ -68,6 +68,10 @@ static int speex_header(AVFormatContext *s, int idx) { } st->codecpar->sample_rate = AV_RL32(p + 36); + if (st->codecpar->sample_rate <= 0) { + av_log(s, AV_LOG_ERROR, "Invalid sample rate %d\n", st->codecpar->sample_rate); + return AVERROR_INVALIDDATA; + } st->codecpar->channels = AV_RL32(p + 48); if (st->codecpar->channels < 1 || st->codecpar->channels > 2) { av_log(s, AV_LOG_ERROR, "invalid channel count. Speex must be mono or stereo.\n");