From patchwork Tue Feb 27 22:47:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 46611 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:aea4:b0:19e:cdac:8cce with SMTP id do36csp25253pzb; Tue, 27 Feb 2024 14:47:20 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUlJiRsd8DhCe7YGK1Gi7EDiY0EVyqViQlqXdOPGR1xvbIlxNwXMlObbTwou5FdCZB75GznuVu/Jn4g8WWvQuoLzRVKRr2lbW6HkQ== X-Google-Smtp-Source: AGHT+IElYFQJN3abnJiBsD4ZWFdYFp0/a2PrnKPn/VuhexLrqhYgzawc0Cy5nqH7ij+3Dyyvmda8 X-Received: by 2002:a05:6512:1307:b0:512:d78e:90fa with SMTP id x7-20020a056512130700b00512d78e90famr7528214lfu.15.1709074040454; Tue, 27 Feb 2024 14:47:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709074040; cv=none; d=google.com; s=arc-20160816; b=AC6qYpu3WCsxaMmWE7tC3w/kSrSYtnvzKJkn558Z4aztuPpQv+/yuvntmJ0It0kg9E 33Lc273IKA0nq87+5DILteyWdLGP51kS2JyfwTFruRWA6YXpFXz6a1SqwEixFEITQorE jgp8T4i5Fxt3iSl7IRdyqGWvuwkFy8GiTiFllOMkNYKKRFFMZ0gIx0qXNixbfwlsbrvG CX4v6kExemHizsQZXrtBkS9533eH5G6TwNUYutHgihnw08DtkOTipomKlSId621PAqj7 9JLn7ZrtYpatTcJHqyTtaLimUTvU+gq8a9jhN54shTJfkjbAzb80/jVVSkqu3CqXhPFQ mVVw== 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:dkim-signature :delivered-to; bh=rbVq2LH6q1JAP2npjhc9/Tq2eoJaLjNxQALa3UNhZd8=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=fWofGCGFhulsyEbtRD6jqfAmLF0NXrn8d94yd7USQUbv1vrFGZE/54VtEheuyXYGpa M2vgciQ4jU4rboB0JUcn5BDsSn5HIiwhg931z9bue/BcJzdIGMHK/f+LS3rzyUudolLg Smk/b72xAoWN4NCCXiVVdjHx8riXK3Qa/vC7ZtjD0IhZTvhZIacC4FSMP+pd6e/QzWoD sdFp1d83XJQ2zbTTNc7f5bRJUa3RDiu8LnNbl5NZn5om1xcK1zhpPs80WcRVjT6ENjsM Tz7eOn3STt+fmzUNL54xxWv3v4WFisJsfuaYHKn5DKnUv3c9e1Ckv9fNLoBFDyDcUNmW 92fw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@niedermayer.cc header.s=gm1 header.b=XhWbjEKk; 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 m16-20020a1709060d9000b00a43358b913bsi1050537eji.701.2024.02.27.14.47.20; Tue, 27 Feb 2024 14:47:20 -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; dkim=neutral (body hash did not verify) header.i=@niedermayer.cc header.s=gm1 header.b=XhWbjEKk; 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 E74F868C7DA; Wed, 28 Feb 2024 00:47:16 +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 1130068B02D for ; Wed, 28 Feb 2024 00:47:09 +0200 (EET) Received: by mail.gandi.net (Postfix) with ESMTPSA id 3AD9D60003 for ; Tue, 27 Feb 2024 22:47:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1709074029; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc; bh=nDKNLFra50SHHfIpTPk+P1EPWOXTeBvoHCcp8gCTiiI=; b=XhWbjEKkYxcN0MRjaiUk9HZIA34DCfhcMcYIQ6nLVPx9x2Lb8Kx67Jzrtq/nhjI5y5aWnj UQGiDgP9iVk+xB4NSxIzTEgMXv5fEYlai6G1Wep2oIJ2YYFaJ4ZpWEPLtsyvCmyQIiuJ4y eCFvGXaSqmV+BHW2cwIsP0bYre4s1dPPpjZcs6Rw+VB2jz9bW99nr+EQwep2pvkq1UZxz3 y+gkfn2+KjQeVVATZ8Jz0ZNnHNskniW0C/d+r7zvAsE3oNxyQKPrTCioX9dPU46AZnZ7tr IUla88kz1W39p13quosmaI7RiYtgssH51EnyUfBxDlOpwR59wGw+oAhTQ31kQw== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Tue, 27 Feb 2024 23:47:07 +0100 Message-Id: <20240227224708.6883-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 1/2] avcodec/vvc/vvcdec: allow vvc_decode_close() on failed open 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: T4GS4XswyaG/ Fixes: division by 0 Fixes: 67008/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VVC_fuzzer-5873503163187200 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/vvc/vvcdec.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libavcodec/vvc/vvcdec.c b/libavcodec/vvc/vvcdec.c index f024cbd067..570e2aa513 100644 --- a/libavcodec/vvc/vvcdec.c +++ b/libavcodec/vvc/vvcdec.c @@ -950,13 +950,14 @@ static av_cold void vvc_decode_flush(AVCodecContext *avctx) { VVCContext *s = avctx->priv_data; int got_output = 0; - VVCFrameContext *last; while (s->nb_delayed) wait_delayed_frame(s, NULL, &got_output); - last = get_frame_context(s, s->fcs, s->nb_frames - 1); - ff_vvc_flush_dpb(last); + if (s->fcs) { + VVCFrameContext *last = get_frame_context(s, s->fcs, s->nb_frames - 1); + ff_vvc_flush_dpb(last); + } s->eos = 1; }