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;