From patchwork Sun May 16 19:38:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 27793 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:b214:0:0:0:0:0 with SMTP id b20csp2232828iof; Sun, 16 May 2021 12:40:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxMX6rWhrhgd7iU8GWkBku3bD2Fc1AcOzLd1HA0E4G7ebD/vd/Kbx+6nyWI2bjWkFpCJo1S X-Received: by 2002:a05:6402:22fa:: with SMTP id dn26mr9301895edb.5.1621194021620; Sun, 16 May 2021 12:40:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621194021; cv=none; d=google.com; s=arc-20160816; b=sKbGlukqrQ8dqOVtfqBE3KNWloZnjUqHyNRHwJwImUweJJwgSgpvfCsDjq3jYTSx+P tD1WiGkWcW2oqXO86y7LQwT2xnYdk0HivTosjK4MWmmqd7phMBJxNAQR2NQzuJPynt6H wvAj1nfS7lRxOchsoUba8l7bbOCnLqhqHO4vXMhCjQxLFmMHOoBP+zBhEKmKVemLSYf0 EwM9aUMQTPIGnfrdw8hPXzQa5AmA6BAmsenneodmu1VY/oQOLK/UwMZmL8aQigER8R9I lgMIKKQYdS4yZjm/TIG5IDQcOS6ueBBcakqzkJe1QCZ6ukfNOru3EJkS23NK3p4L7wad T34g== 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; bh=1D3huO7l9/EUFr1BcyzVqXt3qmvJS599TmBfiLWz6Ys=; b=cJGeK5vxqLuRxqQxcLmTDORa0s/PEdvPhAMsp30AQ/LfpQyBICZaAq1i+93BWdVEa+ JyHRV63amgCRpf+qda2JGitb5LZFWtXrJ9HfXMS+ir/Mrxi7Vn34BPBIZms8soRSpVF2 5NeMHNJRzgkYC9iH1hMeysuTjcO8hfBnXvqvRv28krXKoqq8bnAXE7sSsXlQgV60xKla b5ubRO5qCuSqcdB0ltEGf8kNvZq5FWppe+j2W/HdziL/AP45hApCOmui82aabopk0zeP 2J0BQWBrZ5SPHbifnfgQQfHMRh38yTFDq74S6t3Bgw1bCjBaR3Fo6zx4FD13A99kbJE9 lWdg== 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 w6si13149197edd.329.2021.05.16.12.40.21; Sun, 16 May 2021 12:40:21 -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 D145F689721; Sun, 16 May 2021 22:40:10 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe01-1.mx.upcmail.net (vie01a-dmta-pe01-1.mx.upcmail.net [62.179.121.154]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7B198688181 for ; Sun, 16 May 2021 22:40:02 +0300 (EEST) Received: from [172.31.216.235] (helo=vie01a-pemc-psmtp-pe12.mail.upcmail.net) by vie01a-dmta-pe01.mx.upcmail.net with esmtp (Exim 4.92) (envelope-from ) id 1liMcM-008hhb-0C for ffmpeg-devel@ffmpeg.org; Sun, 16 May 2021 21:40:02 +0200 Received: from localhost ([213.47.68.29]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id iMbNl8pevljeHiMbOlMDzd; Sun, 16 May 2021 21:39:02 +0200 X-Env-Mailfrom: michael@niedermayer.cc X-Env-Rcptto: ffmpeg-devel@ffmpeg.org X-SourceIP: 213.47.68.29 X-CNFS-Analysis: v=2.3 cv=BoHjPrf5 c=1 sm=1 tr=0 a=2hcxjKEKjp0CzLx6oWAm4g==:117 a=2hcxjKEKjp0CzLx6oWAm4g==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=GEAsPZ9sns4A:10 a=ZZnuYtJkoWoA:10 a=g8gZ2V3kerUFJgFHV8kA:9 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sun, 16 May 2021 21:38:59 +0200 Message-Id: <20210516193901.30853-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 X-CMAE-Envelope: MS4wfAbHLxWKs3SDBMnWmq98ybWTAcZcLNGlEOvkBnwQsky5rrzHdTLNGvt4wbSZanVgoy0z8AY80BGAkag/PyJgDvD/LAzAevEAbTSeDjpAhqRcTdS2hg+d 6ESO8+jwP3wKOfvZN3c//qL2QSG15sbuMCMiSRGs727175ic1Bb93uck Subject: [FFmpeg-devel] [PATCH 1/3] avcodec/dpx: fix off by 1 in bits_per_color check X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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" X-TUID: QdRiqr32RK59 Fixes: CID1476303 Bad bit shift operation Signed-off-by: Michael Niedermayer --- libavcodec/dpx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/dpx.c b/libavcodec/dpx.c index 8e77c09bb1..3563bdc538 100644 --- a/libavcodec/dpx.c +++ b/libavcodec/dpx.c @@ -242,7 +242,7 @@ static int decode_frame(AVCodecContext *avctx, return AVERROR_PATCHWELCOME; } - if (bits_per_color > 32) + if (bits_per_color > 31) return AVERROR_INVALIDDATA; buf += 820; @@ -319,7 +319,7 @@ static int decode_frame(AVCodecContext *avctx, minCV = av_int2float(i); maxCV = av_int2float(j); if (bits_per_color >= 1 && - minCV == 0.0f && maxCV == ((1<color_range = AVCOL_RANGE_JPEG; } else if (bits_per_color >= 8 && minCV == (1 <<(bits_per_color - 4)) &&