From patchwork Tue May 16 00:22:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 3674 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.10.2 with SMTP id 2csp234778vsk; Mon, 15 May 2017 17:22:53 -0700 (PDT) X-Received: by 10.223.176.84 with SMTP id g20mr5897118wra.172.1494894173010; Mon, 15 May 2017 17:22:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1494894172; cv=none; d=google.com; s=arc-20160816; b=XeivnmiLq1B2w8kyCl7sYGEPJ295FWsKOIjV9E+AWaGTMwkRwkxmlwBjAdj8V3MtPC ZZdzoGOgU86Q8W190GCb2KelRPQtrYu9ePCwefCi9wxtM9pbjNFCNOUfZa99mBJ+pZBw xlWjAMtdVi5o84HCrmxnyiTCiDbQSKtO/QSn+tkYh4JIZQx4NLVpl4BG38HPKTIJBAFq 340F7fBzM8HI5oYEXlFR4JwLJdT8IocAi1feSQSgZVYyUfv41MDqGCb/CrRlNBiTXI3t jAOqeaxh581mlYupbrLj7wt1DV25OskagoxcF55oD43RS+fK6+HYkDMJyrzPkREJ5vF/ x1vQ== 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:message-id:date:to:from:delivered-to :arc-authentication-results; bh=8ARsOxS5nmf2aU/CiUttqFwAsy/h+/als/CBs09b6uk=; b=qnVERDrxl1amUR2C7+HBuy30ThyUGSr1YRHxy1QM5oUQAu5qO6fdO93RhOynPw4QVq aBlcMkxradbFEAeuoOZ/teRG7tMW7wkjuz6eE5mrwotjVGuEvEV9tciNNvtQbRsPn4+Y IsZn4qJf5ZjRW6cTrQhLVMCLV+sVAJmRH++nDzGqMmDATeTD3IFRoJ2Fs5TsuwC/bQVj aGW2QghNDgBBIJmxvBssZzZ9DWQldNG6zXdnqz7CIbwCiHoR9j+lwsJspjreChPOB1eE 9t7kiM8aojANzlSn+wV8BecIyyPMrAAJa8k8kvJhI3b/MndWYMPTrV4UjbFy2zXKRr9j CAkw== 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 r20si559938wmd.15.2017.05.15.17.22.52; Mon, 15 May 2017 17:22:52 -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; 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 EFA99689211; Tue, 16 May 2017 03:22:49 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe03-3.mx.upcmail.net (vie01a-dmta-pe03-3.mx.upcmail.net [62.179.121.162]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E24AD680C5C for ; Tue, 16 May 2017 03:22:42 +0300 (EEST) Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe03.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1dAQGA-0005Ys-54 for ffmpeg-devel@ffmpeg.org; Tue, 16 May 2017 02:22:42 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id LoNd1v0170S5wYM01oNeXw; Tue, 16 May 2017 02:22:39 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Tue, 16 May 2017 02:22:37 +0200 Message-Id: <20170516002237.8525-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.11.0 Subject: [FFmpeg-devel] [PATCH] avcodec/scpr: mask bits to prevent out of array read 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" Fixes: 1615/clusterfuzz-testcase-minimized-6625214647500800 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/scpr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/scpr.c b/libavcodec/scpr.c index 46f072c757..f6d1e45692 100644 --- a/libavcodec/scpr.c +++ b/libavcodec/scpr.c @@ -488,7 +488,7 @@ static int decompress_i(AVCodecContext *avctx, uint32_t *dst, int linesize) if (avctx->bits_per_coded_sample == 16) { cx1 = (clr & 0x3F00) >> 2; - cx = (clr & 0xFFFFFF) >> 16; + cx = (clr & 0x3FFFFF) >> 16; } else { cx1 = (clr & 0xFC00) >> 4; cx = (clr & 0xFFFFFF) >> 18; @@ -726,7 +726,7 @@ static int decompress_p(AVCodecContext *avctx, if (avctx->bits_per_coded_sample == 16) { cx1 = (clr & 0x3F00) >> 2; - cx = (clr & 0xFFFFFF) >> 16; + cx = (clr & 0x3FFFFF) >> 16; } else { cx1 = (clr & 0xFC00) >> 4; cx = (clr & 0xFFFFFF) >> 18;