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 33E1A48DBC for ; Fri, 26 Jan 2024 21:47:24 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D178D68D0E1; Fri, 26 Jan 2024 23:47:02 +0200 (EET) Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0546468C9F6 for ; Fri, 26 Jan 2024 23:46:54 +0200 (EET) Received: by mail.gandi.net (Postfix) with ESMTPSA id 33B7E240003 for ; Fri, 26 Jan 2024 21:46:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1706305614; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:in-reply-to:in-reply-to:references:references; bh=qogdicezouWFYO+Guqu8i7f6/qwLzhwYtOcDkkl5WqU=; b=CHBh5+ZMF/9/68IiHpGkQlLTgWM3INVsroT9ob9t6AgknjfoIHkZVKFMacdk0IPKnMUg1g Bqd9258F9vTFGvSm0kRvtwsIobFy3IooGqt8Elqlhv7udYFC0yZ8ppfiHNaag1l8mGl28r ETl3nuPTaYolNNS8H5giYyPlm5RNiO/+tu7SIF2gtZqL2fV4edGqAFMsfoX3MpCpwW9wWQ iNxo5UGRMDlBHJ39hXoEj71oEvtagfLku2gNDZ0mDpuZDWjGQS6wEWkvkN4qUaNlSzyMl/ fppqVDrBSmVLjJ1+zluU2NQmSL7m2h6iQkHFqqYgRaVhjjI5P9xkFp2NPKhZiQ== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Fri, 26 Jan 2024 22:46:51 +0100 Message-Id: <20240126214651.22783-3-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240126214651.22783-1-michael@niedermayer.cc> References: <20240126214651.22783-1-michael@niedermayer.cc> X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 3/3] avcodec/vvc/vvc_ps: check aps_adaptation_parameter_set_id 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 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: "When aps_params_type is equal to ALF_APS or SCALING_APS, the value of aps_adaptation_parameter_set_id shall be in the range of 0 to 7, inclusive. When aps_params_type is equal to LMCS_APS, the value of aps_adaptation_parameter_set_id shall be in the range of 0 to 3, inclusive." Fixes: out of array accesses Fixes: 65932/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VVC_fuzzer-4563412340244480 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/vvc/vvc_ps.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libavcodec/vvc/vvc_ps.c b/libavcodec/vvc/vvc_ps.c index c2afc0ac932..41589c138d1 100644 --- a/libavcodec/vvc/vvc_ps.c +++ b/libavcodec/vvc/vvc_ps.c @@ -991,12 +991,19 @@ int ff_vvc_decode_aps(VVCParamSets *ps, const CodedBitstreamUnit *unit) switch (aps->aps_params_type) { case APS_ALF: + if (aps->aps_adaptation_parameter_set_id >= FF_ARRAY_ELEMS(ps->alf_list)) + return AVERROR_INVALIDDATA; + ret = aps_decode_alf(&ps->alf_list[aps->aps_adaptation_parameter_set_id], aps); break; case APS_LMCS: + if (aps->aps_adaptation_parameter_set_id >= FF_ARRAY_ELEMS(ps->lmcs_list)) + return AVERROR_INVALIDDATA; ff_refstruct_replace(&ps->lmcs_list[aps->aps_adaptation_parameter_set_id], aps); break; case APS_SCALING: + if (aps->aps_adaptation_parameter_set_id >= FF_ARRAY_ELEMS(ps->scaling_list)) + return AVERROR_INVALIDDATA; ret = aps_decode_scaling(&ps->scaling_list[aps->aps_adaptation_parameter_set_id], aps); break; } -- 2.17.1 _______________________________________________ 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".