From patchwork Mon Aug 15 17:59:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 37292 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3d0d:b0:8d:a68e:8a0e with SMTP id y13csp1416241pzi; Mon, 15 Aug 2022 11:00:38 -0700 (PDT) X-Google-Smtp-Source: AA6agR7rbqVKQh60VK79auACtxclEbGNph3daZ7EE72H2F0pQx0tItfddSKS1vhJCetUSJS5jYtr X-Received: by 2002:a17:906:9bc4:b0:730:957f:34b3 with SMTP id de4-20020a1709069bc400b00730957f34b3mr10960056ejc.231.1660586438148; Mon, 15 Aug 2022 11:00:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660586438; cv=none; d=google.com; s=arc-20160816; b=0+/kor1rtKzkM0w/RMUO/ssFoL4XfA7i06XDZ7i44QZfeduVILgD+fHAWE4WoG9h67 ZX2UP7UKVCq4J3tGylFf5+XBkcmmjM56aC5oArNn9L92npLZMSs+5l75xVPif9/s8cRX M0Yoigc52O28iiHezKgV/zA8NRSL58e+bEw3idnP58ggN95WWW74ILK4fgI/n5g6sXlR 2vx+KcXDoOivKl25zilWEnSn0R1Aw5vuhEGzUnt2NwfxB5SVuWpLaIqm58No9TuTGo8O 1OMHCnfnPwNSqJE04kSKzS+Bs78ywbg9Fn0wg0yi+CyEL6KKyY0UQcsoHifvVqGx4+Fq /IgQ== 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=UVOCqnzQlUJ5lVFvHWYncQ4VuroeXICAmxaM8C8E0Ko=; b=XfWCiWXMujCQvAheAg1+MESPiKcAGPRlXi5kFYaPsZ4pgWrHcTbPjwGQiPRue1a1j1 E6VUZpVEMFN+vEzclMhjgUQ4udmAPRDDGMtWRWVcyn5UI1jiTn2UvNizVaZcH1nYsocR HNv2hQa92P2H05a95DPYwLc6Hq/JKcBgc6OHOqcB4DeMgJCEUgVd67FGonWfEDNMwQPT Z3jXXkUyTVcd2A07AWOFBVOHRt6hUTaCZxTQJCF1pPYqNCYJug4pkFrbycgfNaq31x5I A4/LSUV7cy1wcAOlQinwoai1Epq4DshaAHeE+9A+DBniH7AHKOsfDJ0TGjIrThQbiY78 gMsQ== 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 du20-20020a17090772d400b007313bdfb98bsi8589169ejc.18.2022.08.15.11.00.37; Mon, 15 Aug 2022 11:00:38 -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 5C68268B462; Mon, 15 Aug 2022 21:00:35 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-at03-1.mx.upcmail.net (vie01a-dmta-at03-1.mx.upcmail.net [62.179.121.151]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D160868B462 for ; Mon, 15 Aug 2022 21:00:28 +0300 (EEST) Received: from [172.31.216.235] (helo=vie01a-pemc-psmtp-pe12.mail.upcmail.net) by vie01a-dmta-at03.mx.upcmail.net with esmtp (Exim 4.92) (envelope-from ) id 1oNeO4-00CWtv-1j for ffmpeg-devel@ffmpeg.org; Mon, 15 Aug 2022 20:00:28 +0200 Received: from ren-mail-psmtp-mg01. ([80.109.253.241]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id NeO1ooH7W8s8UNeO4oXvsq; Mon, 15 Aug 2022 20:00:28 +0200 Received: from localhost ([213.47.68.29]) by ren-mail-psmtp-mg01. with ESMTP id NeN6od1twOPqFNeN6oLhb3; Mon, 15 Aug 2022 19:59:28 +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=OcX7sjfY c=1 sm=1 tr=0 ts=62fa8980 a=2hcxjKEKjp0CzLx6oWAm4g==:117 a=2hcxjKEKjp0CzLx6oWAm4g==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=GEAsPZ9sns4A:10 a=NEAV23lmAAAA:8 a=W9knaO9pGTC2wNZEHy8A:9 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Mon, 15 Aug 2022 19:59:26 +0200 Message-Id: <20220815175927.8743-3-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220815175927.8743-1-michael@niedermayer.cc> References: <20220815175927.8743-1-michael@niedermayer.cc> X-CMAE-Envelope: MS4wfGu65WP3J4gBBLP56OVgCfqhOscZ+RJ9+GJK4MREwB0R3cSGOmo01JxeoNq1VU4LNz5cpQN0xXbbNTnlq4lqMeySckLyuCZX76xTNyuj8yyABKd4tSTl G9nNtbJ7CVg07Slc2p4SOe/8oHLJ/0RJEMc1YbUep+C9ocEOcmQDq3s4kw9LyeAffpH2ZfrKyyVCvA== Subject: [FFmpeg-devel] [PATCH 3/4] avcodec/h263dec: Sanity check against minimal I/P frame 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: 1Uqu9P/7KF4c Fixes: Timeout Fixes: 49718/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEG4_fuzzer-4874987894341632 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/h263dec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c index 8db0eccd89..c03a55a4fd 100644 --- a/libavcodec/h263dec.c +++ b/libavcodec/h263dec.c @@ -553,6 +553,8 @@ retry: avctx->has_b_frames = !s->low_delay; if (CONFIG_MPEG4_DECODER && avctx->codec_id == AV_CODEC_ID_MPEG4) { + if (s->pict_type != AV_PICTURE_TYPE_B && s->mb_num/2 > get_bits_count(&s->gb)) + return AVERROR_INVALIDDATA; if (ff_mpeg4_workaround_bugs(avctx) == 1) goto retry; if (s->studio_profile != (s->idsp.idct == NULL))