From patchwork Sat Dec 4 21:32:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 31969 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp2479861iog; Sat, 4 Dec 2021 13:34:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJzIr2XXIw3J27aH4pzhbPdIq51qOWOQOfO5tzOgj1VmFpVH8MdBSf3gaSWmDdqraOOkukMn X-Received: by 2002:a05:6402:50d4:: with SMTP id h20mr40326905edb.52.1638653650624; Sat, 04 Dec 2021 13:34:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1638653650; cv=none; d=google.com; s=arc-20160816; b=lnuTPo9UI8l64j4rDehcoY7m7cfQfTp2PC9pXozt0aJU5X4qAPlCWJdN/Luv4nh40o zN/OAm4e7hDm+oRADpU+1liUufKRnVoGdA+C2z83ZS0FryXr5FpImnt19qqaAATGOZnt yEot2oUvWwHNpOVxBGm5HvAIyozWg2fQuiJApNt8IX5ph05PLRUybuDJwyIXIklBOFUd Y+zIgSgBrgQwdqX4KEPq1qzHml46xpHubjmRyXFPPvrXXtPRtMJI/5KfCAC+mQ551Ouq Lg4229OnHJwErCpZkhGDEjpe5sf61y9mvrV7QG79EEEzy4hdI28t472ayDDgu2p2NNX3 xLcw== 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; bh=SB36m/o7bCsjTrZa2ZXhi7mxXIiFodwILEdgmJPYr8g=; b=gtRoGGylM9QsKvlf2PF1PM/bRYy4Yvdrj1CO+ZsgC6xtRbVY43hIDk7PlHfxNVGs1B wOVZ0UByGIhUaeagRz5K8bjWNI+JCwhq4Q//QC765Mr5z+YsUmiWvlFqhS/NAqMTUb58 RmSinbMNxXViXj0u2U9txSzGsREDw1bk9MzlLAuz/8Gl54I0bZlAU6TLSP3JKEUAWGpA vKIHVPyItciaHeVFBaZP4OQq3FqgLJr26g+pUwNO6CpORi21auOmsBLldo7zt6GrgHpR XGPSJoSCIuBA2M5NSFjVwWck51Uwywj4VqHuKLslx+6j8PTnj4Uk62BpYot2LssQuvVz elPw== 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 qf31si12326771ejc.782.2021.12.04.13.34.09; Sat, 04 Dec 2021 13:34:10 -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 6279468A61A; Sat, 4 Dec 2021 23:34:06 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe04-1.mx.upcmail.net (vie01a-dmta-pe04-1.mx.upcmail.net [62.179.121.163]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 121DB68A61A for ; Sat, 4 Dec 2021 23:34:00 +0200 (EET) Received: from [172.31.216.235] (helo=vie01a-pemc-psmtp-pe12.mail.upcmail.net) by vie01a-dmta-pe04.mx.upcmail.net with esmtp (Exim 4.92) (envelope-from ) id 1mtcfP-007et2-0J for ffmpeg-devel@ffmpeg.org; Sat, 04 Dec 2021 22:33:59 +0100 Received: from localhost ([213.47.68.29]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id tceRmpEVeSgGFtceRm7znV; Sat, 04 Dec 2021 22:32:59 +0100 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=f8Q2+96M 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=NEAV23lmAAAA:8 a=ANeCzKrynD58fFZXlnwA:9 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sat, 4 Dec 2021 22:32:57 +0100 Message-Id: <20211204213258.11971-3-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211204213258.11971-1-michael@niedermayer.cc> References: <20211204213258.11971-1-michael@niedermayer.cc> X-CMAE-Envelope: MS4wfCq3ZsY4VjhxjtlneW7LD7AmJGIRt3/b+HeJ66HRp50/cpcJmbdNTFFMPBVniykhDGrvB3q74NjiZSXVlfQ1RuACusVi9vj9b3IfcrtuxyJsFHj8vMN6 Vl9aa/e4F2/xsNnM3xY5TOfVD+7oDvDOu2KFTTSoUEZNflFX76t5YKun Subject: [FFmpeg-devel] [PATCH 3/4] avformat/mxfdec: Check component_depth in mxf_get_color_range() 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: N5/THRAPXCxd Fixes: shift exponent 4294967163 is too large for 32-bit type 'int' Fixes: 41449/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-6183636217495552 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavformat/mxfdec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index af9d33f7969..c231c944c01 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -2274,12 +2274,12 @@ static enum AVColorRange mxf_get_color_range(MXFContext *mxf, MXFDescriptor *des /* CDCI range metadata */ if (!descriptor->component_depth) return AVCOL_RANGE_UNSPECIFIED; - if (descriptor->black_ref_level == 0 && + if (descriptor->black_ref_level == 0 && descriptor->component_depth < 31 && descriptor->white_ref_level == ((1<component_depth) - 1) && (descriptor->color_range == (1<component_depth) || descriptor->color_range == ((1<component_depth) - 1))) return AVCOL_RANGE_JPEG; - if (descriptor->component_depth >= 8 && + if (descriptor->component_depth >= 8 && descriptor->component_depth < 31 && descriptor->black_ref_level == (1 <<(descriptor->component_depth - 4)) && descriptor->white_ref_level == (235<<(descriptor->component_depth - 8)) && descriptor->color_range == ((14<<(descriptor->component_depth - 4)) + 1))