From patchwork Fri Mar 9 01:37:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 7882 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.181.170 with SMTP id m39csp430236jaj; Thu, 8 Mar 2018 17:38:21 -0800 (PST) X-Google-Smtp-Source: AG47ELsoN+e4aG7UdThdLxfITGaRBSwW1elOr1p6s6pxT0uXrK+XoJC6nPaQJ9OniPJAIswd69ty X-Received: by 10.223.148.195 with SMTP id 61mr26590295wrr.248.1520559501242; Thu, 08 Mar 2018 17:38:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520559501; cv=none; d=google.com; s=arc-20160816; b=0Nj3hTUDdD2jE7+2SZZrMpCRAtHLiHExaIs9HDNFQTDo97ohq4JeI+VXSk/j2ZaG8+ KRIbt4SBuEnw18WiqwZ/8BxeWV0IJTpqC3m6OBdB231A/KP40c5F2ZfjzZn1wes1ox0w PzG6ImTVmgqAZ4vTKpCJ//YkoWJa599gFDw2on7auMeVl9bvkkogOmisYzc+zBa71pBu 48/ZQPD8pqFhcUcHgqTRSajGcXdZQRBvfY6jL1TmOIe2xB7J697CHa7TTSxd0FcQ/AKF Qca+u5YidHji9aE9JUvn6WONSLgIKUvnv4x8QSNweODE0t6i1XvxxcziHpyWGqVcx588 t8FA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:delivered-to:arc-authentication-results; bh=4I3Rvio5LTO37vQOcwpj2VEUTsIq1mHefBCCIFXBlyg=; b=s8maXq5Wv3ozTAO0qOdFoIlwkiicz/yKy8mD10ArNjdYLOyy5nJBSrILyLwP+eIYd7 jlq0KWVXh2Mxn0eNHE2jcOCGLmYIqEGG2C8cNDNa9l6cjR1/zF+ttYrRO4iHr/lK69Lp 6uyQTfWQifcD8k40MRDKmGt6V5sn6nll8rzDwpNcuIL+2ybrHxh+h7u2pDXX++PJerbZ RWGxB57bp+1HqaIDCKfDZB57cZq+ty284UqOn1yjYVCBWueDdHILr3Ijq71NEDUzgooS 88jiaONf3x16OwOnHHeM3rSAnrMR4DFz129EkCNUMrA6JkLR4RFVFYKGNhIvixdZKhBL dtLg== ARC-Authentication-Results: i=1; mx.google.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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id g132si140528wmd.66.2018.03.08.17.38.20; Thu, 08 Mar 2018 17:38:21 -0800 (PST) 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; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D4D8668A6AC; Fri, 9 Mar 2018 03:38:02 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe07-3.mx.upcmail.net (vie01a-dmta-pe07-3.mx.upcmail.net [84.116.36.19]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A305A68A57E for ; Fri, 9 Mar 2018 03:37:56 +0200 (EET) Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe07.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1eu6yz-0003sN-E6 for ffmpeg-devel@ffmpeg.org; Fri, 09 Mar 2018 02:38:05 +0100 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id Kde41x00Q0S5wYM01de5AC; Fri, 09 Mar 2018 02:38:05 +0100 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Fri, 9 Mar 2018 02:37:54 +0100 Message-Id: <20180309013754.24682-3-michael@niedermayer.cc> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180309013754.24682-1-michael@niedermayer.cc> References: <20180309013754.24682-1-michael@niedermayer.cc> Subject: [FFmpeg-devel] [PATCH 3/3] avformat/oggparseogm: Check lb against psize 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" No testcase, this was found during code review Found-by: Matt Wolenetz Signed-off-by: Michael Niedermayer --- libavformat/oggparseogm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavformat/oggparseogm.c b/libavformat/oggparseogm.c index 4b4edf26ca..a07453760b 100644 --- a/libavformat/oggparseogm.c +++ b/libavformat/oggparseogm.c @@ -176,6 +176,9 @@ ogm_packet(AVFormatContext *s, int idx) os->pflags |= AV_PKT_FLAG_KEY; lb = ((*p & 2) << 1) | ((*p >> 6) & 3); + if (os->psize < lb + 1) + return AVERROR_INVALIDDATA; + os->pstart += lb + 1; os->psize -= lb + 1;