From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id A9E37493A6 for ; Thu, 8 Feb 2024 21:51:02 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id DF98F68D178; Thu, 8 Feb 2024 23:50:59 +0200 (EET) Received: from w4.tutanota.de (w4.tutanota.de [81.3.6.165]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8AF4768C954 for ; Thu, 8 Feb 2024 23:50:53 +0200 (EET) Received: from tutadb.w10.tutanota.de (unknown [192.168.1.10]) by w4.tutanota.de (Postfix) with ESMTP id B4BB510600E3 for ; Thu, 8 Feb 2024 21:50:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1707429052; s=s1; d=lynne.ee; h=From:From:To:To:Subject:Subject:Content-Description:Content-ID:Content-Type:Content-Type:Content-Transfer-Encoding:Content-Transfer-Encoding:Cc:Date:Date:In-Reply-To:In-Reply-To:MIME-Version:MIME-Version:Message-ID:Message-ID:Reply-To:References:References:Sender; bh=qiKM5GkVF1xofWXOxZUjTImHkscR6N1rIOqpB3euYv0=; b=dnMmuchaieuhJukSAB4Id3jiq+lKQwHLYAWI3Ftyx4OnkiZQt9MsCFJHsVazixll D/CQNyJbuuhOvpj8+bVFuugod0vQj4k+bfwFO+bYgJFVpVcXfJh9hMh5AGdqbz10rlE LyC/69ZQ7E0nQ/V4wIx0PXMYz7E1Xo+HeV7D5HtHYmru2dga54T/eLefb/MVVJJmS1R gCSlQWUtFj2MY1G1XEUD+ss5MOOhD7jDcqZW/UExvyY4Kbv4D+A7oBXEyhBdqzzRDUn p/gQ6//ZG5Gc2WU3ybLWKYCsG+KfjN/8aCwnPHszqMFfE+IcN9zkumn7wer1NIjZGkC izo9yK9r3w== Date: Thu, 8 Feb 2024 22:50:52 +0100 (CET) From: Lynne To: FFmpeg development discussions and patches Message-ID: In-Reply-To: <20240208211623.74716-1-post@frankplowman.com> References: <20240208211623.74716-1-post@frankplowman.com> MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH] lavc/vvc: Check fc->ref contains valid reference 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Feb 8, 2024, 22:16 by post@frankplowman.com: > From: Frank Plowman > > Depending on where exactly decode_nal_unit failed, it is possible that > fc->ref holds a VVCFrame which has had ff_vvc_unref_frame called on it > and not yet had ref_frame called on it. In this case, fc->ref most of > the fields of fc->ref are NULL and attempting to call > ff_vvc_report_frame_finished on it will result in a null dereference. > > Patch fixes the error described above by checking fc->ref has not only > been allocated, but also references a valid AVFrame before attempting to > call ff_vvc_report_frame_finished on it. > > Signed-off-by: Frank Plowman > --- > libavcodec/vvc/vvcdec.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libavcodec/vvc/vvcdec.c b/libavcodec/vvc/vvcdec.c > index 8163b5ecb6..246ee79299 100644 > --- a/libavcodec/vvc/vvcdec.c > +++ b/libavcodec/vvc/vvcdec.c > @@ -820,7 +820,7 @@ static int decode_nal_units(VVCContext *s, VVCFrameContext *fc, AVPacket *avpkt) > return 0; > > fail: > - if (fc->ref) > + if (fc->ref && fc->ref->frame->buf[0]) > ff_vvc_report_frame_finished(fc->ref); > return ret; > } > In general, for other codecs, if a reference does not exist, we simply allocate it and pretend it existed and was correctly decoded. This has better resilience against corrupt bitstreams or just bad muxing, and yields an (maybe corrupt) output, which is better than nothing. Is this not possible for VVC? _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".