From patchwork Sun Sep 18 17:14:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 38013 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b1c:b0:96:9ee8:5cfd with SMTP id c28csp791088pzh; Sun, 18 Sep 2022 10:15:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5hmbHYJCWrOobYh5/9NVqTVS/dGKgz+w2u6r14zwZ7vaQlLtA0umV74mcgrrnDWrSESYoP X-Received: by 2002:a05:6402:51d1:b0:451:ea13:1583 with SMTP id r17-20020a05640251d100b00451ea131583mr12382297edd.322.1663521323602; Sun, 18 Sep 2022 10:15:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663521323; cv=none; d=google.com; s=arc-20160816; b=rQaxSPykIx8LEsLGRIzXPPqVuHGduRUHiFvMTzcAvX+r1mjl3J++EIPcO34ejU8DL8 idLDCH40jGxVsJdy4RIN10cw5Q6Rt3VnW+AVMD87O/2SyewAHOW3VUvigkzYNvnzesBE /UpsA4dPsrb/D5W2F27khdo1/OUD7+p8V7H3HlsNsKV1UlkatJ4FTcqyNEMpdI0GlC59 Kl0QYv8FxP1EFabFitp0Xk5HJDhYA+VyEWyGtUZ07+8FHNz5VqZJcgOGfTNsOkGupEwR mjc7aA3EHHYNefaQYUm1xPqltVqEGRepcxMI85VYZW+JkN8c432WNqMtU/pf698c7lSH zd7Q== 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=FNnMPopVF7G7XkHR0BnQ2aQ+MRorjQqlVsLe+iJE92Y=; b=HNoPZS3mOD5ve9b7sQXTP9fcgkixcIL3m8fGegKEIR/87QunSA8kvprOWOn7VS5oc8 Ss+i9cpuicECwB8LCaJnZa7frM8V2vpvchXfDu2CCaLMQG+wQHgReKWV3Xxv3W6rUGgG H2nadN7VWHzojaQf5WruM+SesyigrG8+cbNCHgwO1QJ0yRdWVoOVw/ZZDD81MnDUgbLR Gh6UGD03VpYQPSRDBj+SM8gJiyGQn3TFSaD877bILtaC5OkRlysEGwGJoOJlZUFEZWcc SnxIhLl6h4oUUgkoObD16Ed0iZjVn+lPzQF7NvOoDFBmu+Si/yaCJwvqL12cGfMD6w9/ 09hQ== 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 ww6-20020a170907084600b007708400bee0si14078385ejb.620.2022.09.18.10.15.22; Sun, 18 Sep 2022 10:15:23 -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 E967A68BBC0; Sun, 18 Sep 2022 20:14:25 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-at01-3.mx.upcmail.net (vie01a-dmta-at01-3.mx.upcmail.net [62.179.121.147]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 79F9768BB14 for ; Sun, 18 Sep 2022 20:14:13 +0300 (EEST) Received: from [172.31.216.235] (helo=vie01a-pemc-psmtp-pe12.mail.upcmail.net) by vie01a-dmta-at01.mx.upcmail.net with esmtp (Exim 4.92) (envelope-from ) id 1oZxrv-00Hane-Vc for ffmpeg-devel@ffmpeg.org; Sun, 18 Sep 2022 19:14:11 +0200 Received: from ren-mail-psmtp-mg01. ([80.109.253.241]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id Zxrtom00C8s8UZxrvoH670; Sun, 18 Sep 2022 19:14:11 +0200 Received: from localhost ([213.47.68.29]) by ren-mail-psmtp-mg01. with ESMTP id ZxrvoprDAOG5ZZxrvonHiZ; Sun, 18 Sep 2022 19:14:11 +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.4 cv=KJo5sHJo c=1 sm=1 tr=0 ts=632751e3 a=2hcxjKEKjp0CzLx6oWAm4g==:117 a=2hcxjKEKjp0CzLx6oWAm4g==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=GEAsPZ9sns4A:10 a=NEAV23lmAAAA:8 a=qLX2HWhCFnl5HiQO_hAA:9 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sun, 18 Sep 2022 19:14:01 +0200 Message-Id: <20220918171410.31835-4-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220918171410.31835-1-michael@niedermayer.cc> References: <20220918171410.31835-1-michael@niedermayer.cc> X-CMAE-Envelope: MS4wfI9BV6yW0sx0oIBpYi4B7nmO8jtIIvYg6+aaFCJvkg6qQ84H6NH96xkmjxgD/fY+Cg3mBlLQdhtz+uGHoG/rjXx+ipKMuU2SeT1G+sB0FrDBTbwR1IX4 W/LrQTYGIkSSvK9oSfBJT8OGiWXvxdTvuO/wjC7ywFL768Rvq92EIp2Ai5fRdxPJLZ/P8L4iYd8kDQ== Subject: [FFmpeg-devel] [PATCH 04/13] avformat/rmdec: check tag_size 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: 6SSS/nkVEDbu Fixes: signed integer overflow: -2147483648 - 8 cannot be represented in type 'int' Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_RM_fuzzer-6598073725353984 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavformat/rmdec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c index 881d7002add..0f1534b5820 100644 --- a/libavformat/rmdec.c +++ b/libavformat/rmdec.c @@ -563,6 +563,8 @@ static int rm_read_header(AVFormatContext *s) } tag_size = avio_rb32(pb); + if (tag_size < 0) + return AVERROR_INVALIDDATA; avio_skip(pb, tag_size - 8); for(;;) {