From patchwork Sun Sep 18 17:14:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 38016 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b1c:b0:96:9ee8:5cfd with SMTP id c28csp791321pzh; Sun, 18 Sep 2022 10:15:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4D/og4U7b9SLE3BBX1hQJveqIDB1ZZGN3u7i7tB5QOimb91S8MMAnZBnWy8nFDz7c1jPaM X-Received: by 2002:a17:906:9752:b0:780:5b5f:3573 with SMTP id o18-20020a170906975200b007805b5f3573mr9780481ejy.497.1663521355955; Sun, 18 Sep 2022 10:15:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663521355; cv=none; d=google.com; s=arc-20160816; b=WpMnhVMAnXT7UrCTLR3U0MAwoa8eN6bib48hq3mp5wTg5TRurp/VjVqw1wUX8JoQkk MX7hfTAxgASc6KXgCgT2twhjBnz6FgIWv3u2kysteFwtTJu/FrGhmpyuhIaBPf60XZNI lrIeXhlWFp2nF4I2dWYnyQ1LNslFrTLpKsH6dwSQ6/iGz+oznqtZBU3sfTqYgAOYJm8K 6PcpjF/IriqRgY61mdubTrk3/XZhEp4APGi6NU0B2KTc6lEbtjcBPphrfWpNeDKuwB6O XGGwHgRg63vGaW3ZVddwxWB8l6bw03RPMfdwFhrAk/7Rm6wCd99ZuTbHQ537xL/1MfK2 c6uQ== 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=+rrON0vw0YtmgXA6M4mBt8lx7bCzaI/aENf6PURvUDY=; b=D/JzqTi3ko84/tNst9IbBHm/23NMmHwoT2IrE3lQtMhPZHS+6SMTPVgH/NzaPZur9x T5EBADzhPO2fzFTm1TIsPgbCaeQYWBzB15/nRE3khNdB5eaOwn5ZXg1JbOYW5wxe0R+G 4hhp0DvImEK8R5XQLwESA2TOyuM92sOMHpo5XstqqohqNeRwOvxOYVHH3GFqmR/unMNa xLNXgyzo1IGOlEo4l5c4pgi2sCo3AfGoW3rjahrKDySdFzv+6d53TrDiziyIw+LMlDtY uPLWYqMsmrzkEdmW4BGGYjhgZjHdlc7S1SEzPlXDz+iuuzeCnCNQzcsguz15UnPjhRue zJWQ== 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 ht14-20020a170907608e00b007806fdd9797si8712927ejc.320.2022.09.18.10.15.55; Sun, 18 Sep 2022 10:15:55 -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 2368368BBE4; Sun, 18 Sep 2022 20:14:30 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-at02-1.mx.upcmail.net (vie01a-dmta-at02-1.mx.upcmail.net [62.179.121.148]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4D99568BB45 for ; Sun, 18 Sep 2022 20:14:14 +0300 (EEST) Received: from [172.31.216.235] (helo=vie01a-pemc-psmtp-pe12.mail.upcmail.net) by vie01a-dmta-at02.mx.upcmail.net with esmtp (Exim 4.92) (envelope-from ) id 1oZxrx-0047Wn-Re for ffmpeg-devel@ffmpeg.org; Sun, 18 Sep 2022 19:14:13 +0200 Received: from ren-mail-psmtp-mg02. ([80.109.253.241]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id Zxruom0288s8UZxrxoH67I; Sun, 18 Sep 2022 19:14:13 +0200 Received: from localhost ([213.47.68.29]) by ren-mail-psmtp-mg02. with ESMTP id Zxrxo4StAbZLDZxrxoJKIG; Sun, 18 Sep 2022 19:14:13 +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=Ufwy9IeN c=1 sm=1 tr=0 ts=632751e5 a=2hcxjKEKjp0CzLx6oWAm4g==:117 a=2hcxjKEKjp0CzLx6oWAm4g==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=GEAsPZ9sns4A:10 a=NEAV23lmAAAA:8 a=X31LuYFbodU6tBhASqYA:9 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sun, 18 Sep 2022 19:14:10 +0200 Message-Id: <20220918171410.31835-13-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: MS4wfDbd5uOikFynSxtcRSdV7B3YQPfN2yNcUeVdyOi4L3ghKPwe+KsDCRHWPewzwA6ZXI/LKiigtVT6JaMIl7D9ww+3Q/YDzAQDFndgBv6UaCoz7qpVmUB+ OrpG0F5oIbKBJgD0erQayN25JT8fyhKT9+BX1xm1xHWmkhhnD9IXDr8VGVs2BXRyhRinhQD652Hdjg== Subject: [FFmpeg-devel] [PATCH 13/13] avformat/westwood_vqa: Check chunk 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: e6YqvfggWWyK Fixes: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int' Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_WSVQA_fuzzer-6593408795279360 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavformat/westwood_vqa.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/westwood_vqa.c b/libavformat/westwood_vqa.c index e3d2e2668c4..bd8df5e0b34 100644 --- a/libavformat/westwood_vqa.c +++ b/libavformat/westwood_vqa.c @@ -274,6 +274,8 @@ static int wsvqa_read_packet(AVFormatContext *s, return AVERROR(EIO); /* the decoder expects chunks to be 16-bit aligned */ + if (wsvqa->vqfl_chunk_size == INT_MAX) + return AVERROR_INVALIDDATA; if (wsvqa->vqfl_chunk_size % 2 == 1) wsvqa->vqfl_chunk_size++;