From patchwork Sat Dec 4 21:32:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 31973 Delivered-To: andriy.gelman@gmail.com Received: by 2002:a0c:cdc3:0:0:0:0:0 with SMTP id a3csp3904181qvn; Sat, 4 Dec 2021 13:34:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJy+YZt7pfUxzlpj6oQSnU6ghoyB29f/nwCiTNs16KMWY/b1JsrlcEB6vkZRMFMEhwHs8fAk X-Received: by 2002:a05:6402:845:: with SMTP id b5mr38793031edz.392.1638653656796; Sat, 04 Dec 2021 13:34:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1638653656; cv=none; d=google.com; s=arc-20160816; b=wkM9Gy02GPJRivUW95M7fD3bK9kZRyocFpdjrdYloFT5fed3tQzUAQwGi/L00uwx2k xiNwdM2TaPrHGdPPwPhm9Z6dZRPhXXHilEp84LJFoOMkCmJ1yKFdOdrqZJG672R0odsz O3B4C0IuckLMUNf+Psec3ZNgelrpXIfopzMvCnhQRlV6k7n/cC9/ATDd9LGpzEOYuZ3b q/uVNvr5DVBb3VuczHFDIc+3PAJ5GKgxF/Fci4Dmo8rZacYeAq/83a4qaex8WunZqfaH VPTatbouwJgG0Ou60Gg16+AXJ3xUp+e4eJnvI8uTRoInAqDSDy2+4CraV/vNsI0yYuDg wBuw== 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=rcwY1x4tiG/mwvpMIUk1e3wBb3yZWYo3biIsQD/ySfY=; b=mX8Khj1IeOVwUbhUOeTIQYqjsxK+lPaGHiCPHm6y0IeH53QAnVrKksChgR9df8n0sR 69oXefTLGIsrNLAP9h/Bla+cScQ+22UBCiio4rmdYJpxBUhaqZx2hN+7+5ZuU0E81VhR Btk7ptA8GEpGcGp+9K238kU6Dh2z9f4nviNnI0OiTbema3tLkd3X/6aXW0AM2BugAkOa Z/Tfom8/fHFnK2hpsdH6cx2yyiGC2k0O2oysVA8Cc7De7ezapq+MSxPfKxAUTBo44KBB nGL1PtNs1r607DByPlsAARDeV4YJSMwrO2T5WUFqRSuMZnHq3tWVJKrZcZcxOTmiH4p4 le4g== 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 16si9119210ejf.233.2021.12.04.13.34.16; Sat, 04 Dec 2021 13:34:16 -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 38E2A68A628; Sat, 4 Dec 2021 23:34:07 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe05-2.mx.upcmail.net (vie01a-dmta-pe05-2.mx.upcmail.net [84.116.36.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2C4BA68A8D9 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-pe05.mx.upcmail.net with esmtp (Exim 4.92) (envelope-from ) id 1mtcfP-00HUSN-0I 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 tceQmpERASgGFtceQm7zlk; 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=qX5wZS9MHFB6eZLz2DQA:9 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sat, 4 Dec 2021 22:32:55 +0100 Message-Id: <20211204213258.11971-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 X-CMAE-Envelope: MS4wfCq3ZsY4VjhxjtlneW7LD7AmJGIRt3/b+HeJ66HRp50/cpcJmbdNTFFMPBVniykhDGrvB3q74NjiZSXVlfQ1RuACusVi9vj9b3IfcrtuxyJsFHj8vMN6 Vl9aa/e4F2/xsNnM3xY5TOfVD+7oDvDOu2KFTTSoUEZNflFX76t5YKun Subject: [FFmpeg-devel] [PATCH 1/4] avformat/mov: Check for EOF in mov_read_glbl() 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: 0925IgIpvSUA Content-Length: 1184 Fixes: Infinite loop Fixes: 41351/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-5433895854669824 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavformat/mov.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/mov.c b/libavformat/mov.c index e34453432d3..ff5a55d0e62 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -1930,6 +1930,8 @@ static int mov_read_glbl(MOVContext *c, AVIOContext *pb, MOVAtom atom) // wrap a whole fiel atom inside of a glbl atom. unsigned size = avio_rb32(pb); unsigned type = avio_rl32(pb); + if (avio_feof(pb)) + return AVERROR_INVALIDDATA; avio_seek(pb, -8, SEEK_CUR); if (type == MKTAG('f','i','e','l') && size == atom.size) return mov_read_default(c, pb, atom); From patchwork Sat Dec 4 21:32:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 31971 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp2480098iog; Sat, 4 Dec 2021 13:34:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJwt87olyRDQ5JxUQuRFwJaq667HE7MD7uNJu2n3ptY8ta98FtoZNELuXVzAsU6YHNeb87+m X-Received: by 2002:a17:907:8a12:: with SMTP id sc18mr34395956ejc.274.1638653668272; Sat, 04 Dec 2021 13:34:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1638653668; cv=none; d=google.com; s=arc-20160816; b=AmU98qE30JQVFvp0B7kC27ra9R7kQd+PRkA+7B8JyHBCP/udcO9TfoGZhFjg28jBhV QnclRonDQzNRlxRWMUgW5hyXoFdHFBVFxvqMhkRa2HiC8UAeB2t8NvXSJe2uDjINY//y w2OF205pNJq5tpFGRzbvKEpB/R4xmpkocxV8MOQliZpX/FHPSnE52qH/OGcN5nYVYxNB ECH/Os+rUVWSRu86uGqJw2rzpYKxLY/GxwYqPX5CJ27BiN4Pv4kZb2PKkzAyV8fAZMKS 8vpSAePNVQ4pAPcFDruhNd42M0jJCHeTfeufXIoT8ImDxccbJs8bbZJXkK4F7KcanAaa IXBQ== 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=82aXtcxDy7/Wl/l7UGwPrNx5XO81lUtjOja44YKXUl0=; b=ILVbRKrpdp7j/l0xtQhPJi2P3UbwQx90xHf7g9qhixkrkFNlXaKJycK3MakF8Rd+m+ RB3tu5jOkaWBIlR7wjuiNXCChzyWp54p2tlTmZl/oYbO9K8MUeJG4LgC1FCXStcmkl+O 64eGuL41tbSjg0PI13u9ge6RrWW2+tlY/xIt1TtPEjRpTiL64bBq4xnq1HC4oGlxDxMK h2EaTOAySKrTGm3yqADUxzKlwv0lyiYEMSArD9Bwk2PAJyYZPNBh0tv7xMrdloGI2sQf mBXi656I74P/xLxxmON5e7lXZl9Ud0TCJbz/Od34jy72Bofa713LgYF01gO6kdz/VknG +kpQ== 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 hg2si12501388ejc.416.2021.12.04.13.34.27; Sat, 04 Dec 2021 13:34:28 -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 848BB68AE34; Sat, 4 Dec 2021 23:34:08 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe05-2.mx.upcmail.net (vie01a-dmta-pe05-2.mx.upcmail.net [84.116.36.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3085768A61A 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-pe05.mx.upcmail.net with esmtp (Exim 4.92) (envelope-from ) id 1mtcfP-00HTq0-0I 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 tceRmpEUISgGFtceRm7zmw; 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=9kAIknLzNnqyaQ3HitYA:9 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sat, 4 Dec 2021 22:32:56 +0100 Message-Id: <20211204213258.11971-2-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 2/4] avcodec/avpacket: Perform fewer reallocations in repeated av_grow_packet() 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: OTB88i7NRipL Fixes: Timeout Fixes: 41446/clusterfuzz-testcase-minimized-ffmpeg_dem_SAMI_fuzzer-4667644540747776 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/avpacket.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c index d8d8fef3b9e..b10498bfc1d 100644 --- a/libavcodec/avpacket.c +++ b/libavcodec/avpacket.c @@ -142,7 +142,12 @@ int av_grow_packet(AVPacket *pkt, int grow_by) if (new_size + data_offset > pkt->buf->size || !av_buffer_is_writable(pkt->buf)) { - int ret = av_buffer_realloc(&pkt->buf, new_size + data_offset); + int ret; + + if (new_size + data_offset < INT_MAX - new_size/16) + new_size += new_size/16; + + ret = av_buffer_realloc(&pkt->buf, new_size + data_offset); if (ret < 0) { pkt->data = old_data; return ret; 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)) From patchwork Sat Dec 4 21:32:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 31970 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp2480220iog; Sat, 4 Dec 2021 13:34:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJwHz7PBWWz1dlYaceJ1xHlHw2G/fDrJe920PnfgyB7NRoYBSjCk3quFZhHtk03l8FZq1DEI X-Received: by 2002:a17:907:1deb:: with SMTP id og43mr33405454ejc.189.1638653678995; Sat, 04 Dec 2021 13:34:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1638653678; cv=none; d=google.com; s=arc-20160816; b=Yn87F1JSpEKg/VmJgh8JvsSaVcheMS44nYviivNQIT+u+tG84aVh2kk+bLz+2ftSYa aCn+OOsIElRBvTt8CMBm8y8OBaCOZ6hATE48j5ySHg7haMU0EKo7DKe+/yAIKk7f3RhB 7luWs0IqsVKdrtN9rmTz7Hg4nvFYh4Zhzg3jkVsoL8fYddOyvff+kaFfXDg9dv9DHzSy VJaNTIJODrPp6wsohstsOcSXLZACpCO3/XdXJHJYpT44Etb4Dd4bd7DiAt9/BEVFA3jx ELu2y2Pb+uhN/wWpwZIb8MqfU+rrSMFJzGsTT1RtB/N1mGbQRgzxxj8L8OdS6gp8OPOb Ge+g== 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=FqFreQSEObiRK8Ta/UM2uv7eHvX4ArVcZxGkD/R3ffk=; b=Kat3gTuGm0V6hTWuLrZ/w5D1uo0tx1Hl5CoKGVXRdUeB2dV1IVXnYGK+eQ2cEp/Btw Gd5CTRI0BCXzk217iUOwFAVQrngB/BRRkYxL66rPCqhkJjN2N98xcWZM+nATenYgpt4V 1sKuCKO9K4OJcBoiLMddhu0lWTnmoy20kqAO1UFi+Z99za6rLlv/gjR5NB1DE3qEiR7X rtsDNVyACHulYKO+b4SxunIYcEVQa+xQLiMc+vWsBxmusHU9YP25JQTNIbttj2/8CI8W PYAB1njcjw3g3qfWwFhuqMsXuQcpsesCuJaeR8BimEm4CJkyQRwdj98JzDtA7KZX5p3B L41w== 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 h23si9396391edw.73.2021.12.04.13.34.38; Sat, 04 Dec 2021 13:34:38 -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 7727268AE46; Sat, 4 Dec 2021 23:34:09 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe02-2.mx.upcmail.net (vie01a-dmta-pe02-2.mx.upcmail.net [62.179.121.158]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C4F8A68A1A7 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-pe02.mx.upcmail.net with esmtp (Exim 4.92) (envelope-from ) id 1mtcfQ-0001z7-0K for ffmpeg-devel@ffmpeg.org; Sat, 04 Dec 2021 22:34:00 +0100 Received: from localhost ([213.47.68.29]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id tceRmpEWvSgGFtceSm7zo7; Sat, 04 Dec 2021 22:33:00 +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=TIUdAYB9DNzxEfSAvAsA:9 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sat, 4 Dec 2021 22:32:58 +0100 Message-Id: <20211204213258.11971-4-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: MS4wfA+RbEw2y3uQsc0KxJhaU/nIrwGnLzTv44W8kIpqzX/11dhFGqz8syyLhqDxi2/nup28nvLh6HaPCRbPbWFVaJTqGtqRhv4C7fvxboeqdSFeezMwO6wo PBpwW+c9zpk5H5vNiKkyFx83ySZ3bxOysB+oB9sHCegMjcSI9DHyF3JT Subject: [FFmpeg-devel] [PATCH 4/4] avformat/mov: Check next offset in mov_read_dref() 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: IceLUL0wPXd4 Fixes: signed integer overflow: 9223372036200463215 + 1109914409 cannot be represented in type 'long' Fixes: 41480/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6553086177443840 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavformat/mov.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index ff5a55d0e62..869ff1c7c43 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -610,11 +610,13 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom) for (i = 0; i < entries; i++) { MOVDref *dref = &sc->drefs[i]; uint32_t size = avio_rb32(pb); - int64_t next = avio_tell(pb) + size - 4; + int64_t next = avio_tell(pb); - if (size < 12) + if (size < 12 || next < 0 || next > INT64_MAX - size) return AVERROR_INVALIDDATA; + next += size - 4; + dref->type = avio_rl32(pb); avio_rb32(pb); // version + flags