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 D81BB4BE31 for ; Wed, 17 Jul 2024 06:42:52 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id ED94468DA1C; Wed, 17 Jul 2024 09:42:48 +0300 (EEST) Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id ED21568D9CC for ; Wed, 17 Jul 2024 09:42:42 +0300 (EEST) Authentication-Results: mail0.khirnov.net; dkim=pass (2048-bit key; unprotected) header.d=khirnov.net header.i=@khirnov.net header.a=rsa-sha256 header.s=mail header.b=P/j3OCD2; dkim-atps=neutral Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 9AC61240DB7 for ; Wed, 17 Jul 2024 08:42:42 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id GOc-fhUILqZP for ; Wed, 17 Jul 2024 08:42:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1721198561; bh=rgAdPV3hXnfzwlqWnBbQCeCkFgAMcmzgMABssiLoV8o=; h=Subject:From:To:In-Reply-To:References:Date:From; b=P/j3OCD2nimaEni84M6H30DdDwBs288J9POPo28xWDaNt8oPBz4W96txGSLJiw2i4 ZMtIcDNPSfXqP1IKotQ2M7uwOuRyHbVMqRI+1MxrT/9gdM01Kt2Yolnbc8dzPXmFDC tjgWAy1WtvXk7VllPpH6Fvs7mmzbKSW+uKwt+ijJdjVMWJPT/Va02I/oQcI6/S0Bhw rNZA1FB5mjNNrNg1ghCl48gRMPONBi4TIn536NSZ5uUEbyTxHM7P80NSz4PYUApvs5 SmXekX5YvJnGqLkOTFnH6+ILnuXM2vY1RCREWUUYyDdhkkd2vehq0fUA+Mfs+fp1EY JFhDUznvRKraQ== Received: from lain.khirnov.net (lain.khirnov.net [IPv6:2001:67c:1138:4306::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "lain.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id E91D4240695 for ; Wed, 17 Jul 2024 08:42:41 +0200 (CEST) Received: by lain.khirnov.net (Postfix, from userid 1000) id D3AF31601B9; Wed, 17 Jul 2024 08:42:41 +0200 (CEST) From: Anton Khirnov To: FFmpeg development discussions and patches In-Reply-To: <20240715144825.3652038-1-michael@niedermayer.cc> References: <20240715144825.3652038-1-michael@niedermayer.cc> Mail-Followup-To: FFmpeg development discussions and patches Date: Wed, 17 Jul 2024 08:42:41 +0200 Message-ID: <172119856184.21847.8183623909028998274@lain.khirnov.net> User-Agent: alot/0.8.1 MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH v2] avcodec/hevc/hevcdec: Do not allow slices to depend on failed slices 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: Quoting Michael Niedermayer (2024-07-15 16:48:25) > An alternative would be to leave the context unchanged on failure of hls_slice_header() > > Fixes: out of array access > Fixes: NULL pointer dereference > Fixes: 69584/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5931086299856896 > Fixes: 69724/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5104066422702080 > > Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavcodec/hevc/hevcdec.c | 12 ++++++++---- > 1 file changed, 8 insertions(+), 4 deletions(-) > > diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c > index 0e4b26dad3b..80d59ab1916 100644 > --- a/libavcodec/hevc/hevcdec.c > +++ b/libavcodec/hevc/hevcdec.c > @@ -621,6 +621,10 @@ static int hls_slice_header(SliceHeader *sh, const HEVCContext *s, GetBitContext > > if (pps->dependent_slice_segments_enabled_flag) > sh->dependent_slice_segment_flag = get_bits1(gb); > + if (sh->dependent_slice_segment_flag && !s->slice_initialized) { > + av_log(s->avctx, AV_LOG_ERROR, "dependent slice failed\n"); The new error message seems worse than the old one. A slice is a passive object, "slice failed" makes no sense. > @@ -3155,8 +3156,11 @@ static int decode_slice(HEVCContext *s, const H2645NAL *nal, GetBitContext *gb) > int ret; > > ret = hls_slice_header(&s->sh, s, gb); > - if (ret < 0) > + if (ret < 0) { > + //The code is not capable to rewind from an error, the state now is inconsistant so we cannot use it on depandant slices ^ ^ e e Also I'd drop everything before the comma, why mention rewinding that is not implemented and may not be a good idea anyway. Otherwise patch LGTM. -- Anton Khirnov _______________________________________________ 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".