From patchwork Sun Nov 27 22:34:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 39517 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:999a:b0:a4:2148:650a with SMTP id ve26csp7111737pzb; Sun, 27 Nov 2022 14:34:46 -0800 (PST) X-Google-Smtp-Source: AA0mqf7t5W1Oy/jIjtbwjvltLXMRQWynU5PeQSMqGTUsCOm9qRMuDDdUlfhyxopxlH8nZxgQqq/3 X-Received: by 2002:a50:fe0e:0:b0:46a:cb3b:d117 with SMTP id f14-20020a50fe0e000000b0046acb3bd117mr11454942edt.103.1669588486591; Sun, 27 Nov 2022 14:34:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669588486; cv=none; d=google.com; s=arc-20160816; b=I7cHiadNSpaN6PCMiJKwHw1cxNbL8NkvEuw6MthoUrLxYM7zryRccg8CuBjZt+npva Tm84o0YGrVOARiszAJIaxcadH18saxuBh60sYVamJ0aoZncj+QT6FusUxkqiNA/kE0h7 OMga9kBtlUuhgSxfNe/jCmB0ANfP0tsNB+B8D8FG4h8B0WObb606zvO9Zm6arNlNl0Yq Omq2nlVrLzsYmQQpH68JXAHbQcIn90otm7FFKmuuhdg9d1TEZ5Q3OKUB9W+xwhKlquXI 9/ee9E7Quy6S+9jxyUYvYIOaT7+zCT13Vk7OyYePtqiFm6qNQpm+xN/ClDNgsGkFBvS5 LNeQ== 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=Mz/tY0bTLknMbhe9c170qHj1Rqni7hnuPrtISQxm8Xo=; b=zAPR8frYReYU8aEKrCosP86gcfbOi0xJy3WC6P/KcBvfR2EQmSdqmP3F/06U+220VD R0mQsCY1pRiZqPC4SCHacaTRDCoJnNfa/eb824fuKryGO9tf34KmIbk0qRY08p4se+IZ 5NGJJw6oea0hpSq+4hxza64iAsLfq4kOO37OoCn9YUIv0DcL0h5QYt4b12oGoCwQgKEM 9OQTxgqcc6pglS61PWZnVMrs70mtpZU98fM1IjHRyxlDpQjGWjgK5v1YdVmJLVmih37w 5FmbgX8MpRBAOahii5OHdosdzxg6ajQAjKv3ZmByYNaxuRPG/KdTYrPDJaoXRJt5MeY5 +w3g== 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 gn12-20020a1709070d0c00b007be435937f3si3958383ejc.734.2022.11.27.14.34.46; Sun, 27 Nov 2022 14:34:46 -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 1C52368AEE0; Mon, 28 Nov 2022 00:34:43 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 15DD568A985 for ; Mon, 28 Nov 2022 00:34:37 +0200 (EET) Received: (Authenticated sender: michael@niedermayer.cc) by mail.gandi.net (Postfix) with ESMTPSA id 0ACA4E0004 for ; Sun, 27 Nov 2022 22:34:35 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sun, 27 Nov 2022 23:34:33 +0100 Message-Id: <20221127223435.8362-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 Subject: [FFmpeg-devel] [PATCH 1/3] avcodec/mpeg12dec: Check input 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: GMuH2ocQ1a6t Fixes: Timeout Fixes: 53599/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IPU_fuzzer-4950102511058944 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/mpeg12dec.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index 914516bbd9..c93368e255 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec/mpeg12dec.c @@ -2969,6 +2969,9 @@ static int ipu_decode_frame(AVCodecContext *avctx, AVFrame *frame, GetBitContext *gb = &m->gb; int ret; + if (avpkt->size*8LL < (avctx->width+15)/16 * ((avctx->height+15)/16) * 2 * 7) + return AVERROR_INVALIDDATA; + ret = ff_get_buffer(avctx, frame, 0); if (ret < 0) return ret; From patchwork Sun Nov 27 22:34:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 39518 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:999a:b0:a4:2148:650a with SMTP id ve26csp7111779pzb; Sun, 27 Nov 2022 14:34:54 -0800 (PST) X-Google-Smtp-Source: AA0mqf4sjrfATsW+0QytKoTscTWh4a0dW6XACWBnGz97XufvVEI+kb9lVKKiIp0RjV2+JY57yhbA X-Received: by 2002:a17:906:15ca:b0:7a5:7c1c:cc5c with SMTP id l10-20020a17090615ca00b007a57c1ccc5cmr40837153ejd.644.1669588494029; Sun, 27 Nov 2022 14:34:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669588494; cv=none; d=google.com; s=arc-20160816; b=kGUZRhgGpXFUo7/Ti5LIpQUwOIX7OIKY8QlcnnD+p3LdnAD9PPExlBRTMfFjVfosOb falOup+dTk2liEsL2B0FpcTgOzVF3cZ1BcfyZ993tR9/Bp1Q0641LukoH3BEHX1Idz+j WRNfSSlzJ97C3KpcchokHohiZbAKwGRCTM1TWUPrJV03q6i8Me62EDAkWyi38We+UxPH feJPyd3PphSBxlll/LhxJCMNLcUOjBHrEdmo49V5gSM/gKLg14yN1LqgjTcCTHqsNuA6 LxeIS+5JbXfnm7Sr/tWrr+SToa1lZhVcEqkbg+iNKfwQQPkE7FwEqYSGTBD2r8T9o7sY pApQ== 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=EYjbtFB4QbGDoiaj8eLFw+RWr+9QVvPhvsjRL74bQXI=; b=Pj+NLpAlmS3djSgv0NueRY1ZE9hyuXFg/rUV6a1/BjBDx5Gl2GOFmIuT44z6V/dp27 iiaUYDxfWbORJl0nglTAD61Mm1tnEz2bpPoQscc4vM8tZGncFxQ5/sThq+LU81BBMmkp 8BhPtLgGooUKPiRjiN8M0QCapDsU2CwQanq6QWJEQPEc2vkGmWF/la/9h/oyL0+1u79+ tEYAcE3qApftH5O9Mz11593W1N6+wktuxsmRvhPCMQKzB0jIV04BiflN1g1UGCHzC4dt 0Fb7LYItlQQqN0+Wjf+SA9Co1kfP02zTiAaegrz6ZsnrbZn0crrAcSpNN+9ZmrqhmU7E 3KBA== 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 xf9-20020a17090731c900b007b28c65347esi8785626ejb.695.2022.11.27.14.34.53; Sun, 27 Nov 2022 14:34:54 -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 2C50B68BBA4; Mon, 28 Nov 2022 00:34:44 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CD64668AEE0 for ; Mon, 28 Nov 2022 00:34:37 +0200 (EET) Received: (Authenticated sender: michael@niedermayer.cc) by mail.gandi.net (Postfix) with ESMTPSA id 02203240004 for ; Sun, 27 Nov 2022 22:34:36 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sun, 27 Nov 2022 23:34:34 +0100 Message-Id: <20221127223435.8362-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221127223435.8362-1-michael@niedermayer.cc> References: <20221127223435.8362-1-michael@niedermayer.cc> Subject: [FFmpeg-devel] [PATCH 2/3] avcodec/vqcdec: Check width & 15 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: yF+Vy4QbzPjX Various parts of the code assume that width can be divided by various powers of 2 without rounding Fixes: out of array access Fixes: 53623/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VQC_fuzzer-6209269924233216 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/vqcdec.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/vqcdec.c b/libavcodec/vqcdec.c index 18cd99462e..c3bce87974 100644 --- a/libavcodec/vqcdec.c +++ b/libavcodec/vqcdec.c @@ -71,6 +71,9 @@ static av_cold int vqc_decode_init(AVCodecContext * avctx) static AVOnce init_static_once = AV_ONCE_INIT; VqcContext *s = avctx->priv_data; + if (avctx->width & 15) + return AVERROR_PATCHWELCOME; + s->vectors = av_malloc((avctx->width * avctx->height * 3) / 2); if (!s->vectors) return AVERROR(ENOMEM); From patchwork Sun Nov 27 22:34:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 39519 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:999a:b0:a4:2148:650a with SMTP id ve26csp7111827pzb; Sun, 27 Nov 2022 14:35:01 -0800 (PST) X-Google-Smtp-Source: AA0mqf5fhhoTDWdL1o5JOhAGWu0BoR2zkhLJZEOQbcB5cvi4k1VKbi1uKrxTxVEYUuGVpww+6qtu X-Received: by 2002:a17:906:2481:b0:7b9:a749:e70b with SMTP id e1-20020a170906248100b007b9a749e70bmr19248873ejb.567.1669588501305; Sun, 27 Nov 2022 14:35:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669588501; cv=none; d=google.com; s=arc-20160816; b=m8ygqR5tnnmJKNKrc830AclWMunnmEiD+DdRt31UmVtsab2YQqMhC+1jRgOjKoSRPV 784dOR5K1yhqKOo8FvqKq9mVsu1LLZWN18HC03GsbQ0MTKRTysJplhINuEr2RMcf4iKx toFfOeNyTZ9PBd6UbuhXb6xJfih4Wcg1YeeTz8Jvb4SzBui137AUeqOCQnxECDDYtIPS U64/j7XY0y/Dz/T3AmBXIFBfdLJxL3qtdVvvCFzU0WGgJm24c3RMpQlY9TyHw9Gmyhzt gwC8HGesz4IPTbhXdgQOFNX5SL+WQcxu8MbsOg4XnpLodbE6F92xrlXfkIE9zNOJj/lt IIDw== 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=vuQFS8VY33QIANU7dqY7RelZC/GsIpHuBhk1KkiH0NY=; b=Nq09rolYPHmy/eZ/vN9f3C79/SIEkUKSJXSpBlEArbcxiaTczHOQteTjJhWup81J3b CsdkZ8LTUnEa3B6j4vtBzn2A4wtk/fIXX2XFhuP6HEvHJN1a4zTZCLANIYzlJl1iGnqe pJNXOhsaUVEyZHW5J3uL9Jv1EehNJSJTc11e6I6KjiuAdChsqUcKS9ZMLZzGcsVrS5PD ntEHnqXRgiJ58/KXiYlwI8NiPG+HLJgNqGQ7VNdIW8fpS8QoPDwLlMTmPxXWdsuMHrWC XotKJyLJhLXhESuJyeAhOvllpFiAsxqa65L0pnChRLW8ZKwYn7x47hXt2M5fJ4bolIhm Q0Eg== 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 gv21-20020a170906f11500b0078d8bd255d4si7024519ejb.949.2022.11.27.14.35.01; Sun, 27 Nov 2022 14:35:01 -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 270B068ABFD; Mon, 28 Nov 2022 00:34:47 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E4E8168BBA4 for ; Mon, 28 Nov 2022 00:34:38 +0200 (EET) Received: (Authenticated sender: michael@niedermayer.cc) by mail.gandi.net (Postfix) with ESMTPSA id 1462260003 for ; Sun, 27 Nov 2022 22:34:37 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sun, 27 Nov 2022 23:34:35 +0100 Message-Id: <20221127223435.8362-3-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221127223435.8362-1-michael@niedermayer.cc> References: <20221127223435.8362-1-michael@niedermayer.cc> Subject: [FFmpeg-devel] [PATCH 3/3] tools/target_dec_fuzzer: Adjust threshold for RSCC 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: /81cawAMWGXL Fixes: Timeout Fixes: 53681/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RSCC_fuzzer-6627455180079104 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- tools/target_dec_fuzzer.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/target_dec_fuzzer.c b/tools/target_dec_fuzzer.c index e64a362fb6..a20345db5c 100644 --- a/tools/target_dec_fuzzer.c +++ b/tools/target_dec_fuzzer.c @@ -267,6 +267,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { case AV_CODEC_ID_QTRLE: maxpixels /= 16; break; case AV_CODEC_ID_PAF_VIDEO: maxpixels /= 16; break; case AV_CODEC_ID_PRORES: maxpixels /= 256; break; + case AV_CODEC_ID_RSCC: maxpixels /= 256; break; case AV_CODEC_ID_RASC: maxpixels /= 16; break; case AV_CODEC_ID_SANM: maxpixels /= 16; break; case AV_CODEC_ID_SCPR: maxpixels /= 32; break;