From patchwork Sun Jun 23 23:01:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 50103 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:ae71:0:b0:482:c625:d099 with SMTP id w17csp1693058vqz; Sun, 23 Jun 2024 16:02:11 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUWHxKqVokfSYQfo8BgSYiH5fQLjfz0QzXJCfH0l1zvcSqlMeXzNvK9q0PlGCkcEZuAJsKJuxc0yzaOQv+MaeH2RWgO4piXCmXKiA== X-Google-Smtp-Source: AGHT+IEr/xdf6jPBdaSYw7we/aLy0C//Hhi3mmUHj5+yJaNe8QNoL02v68N7pBhhxWCZETh1yWfe X-Received: by 2002:a17:906:99cd:b0:a72:518f:3baf with SMTP id a640c23a62f3a-a72518f3cc3mr114673766b.6.1719183720337; Sun, 23 Jun 2024 16:02:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719183720; cv=none; d=google.com; s=arc-20160816; b=dYfMDRgGAIIdVFRnql5DDnr6nfIPZ7DMjdxfKsl0t1oFZp/jlcY/+F+jZmDfUTO37B X/R86HH4YE14j5u40oUw1vjvAre0uvChZQMAJ91RZxazLiwvMztEdd1zv/WM5RerFfm9 gHLc5JkvPIfz5k9QKHViDL7+wGZP9U+AASbQ6M9fcoAurJOVm3e4SnqStEx0dWURZPhA 9ZFA+BLpuBAmy0a8yAJiRreZ0rJWPKo799ppoljmsGQikatYNHG9DY/H0GAZvc9X+fWe 5aVYktHlkEHSem/yYXCureLgbB56Qkl/9vaIdQtrim80gHjBOfOk+QcHmZ9We7IkykVq /SYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=YQLyeAWak7i6sVXFNR6D399k6njyyUqgtbk4cu+sekI=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=jYtrKA6DK+lJYdKwpSaAotyYyQtOk92qXONLdeSvOcl5lMfF0V5KX+3DmHA9jxJkcR v9YFeFmX4mEw8/Lq4cIDRzy8+Ml4mLJsfCYuPjPR0TIM/9jDV/JGBR6vtqt+AKZgNy5O Dc32vn0cJa3wVU5tbSRXEna6CKv+YXgPW4fwrE6U0GTSCO579MqdsBl2di4qM47NawIb RE08l61FdexbVVlLUR87J9Yz/XND4iRGIR35iYbkewDnaslP2+3Q3jnpnKPyRyMKPoCl PYtPRhd9y4ud6h3R5iZPrKYLek4beWVV63hlHb8ziDQRSz73tOxzQqA1qVDsuKnYgxk3 AyAg==; 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=pHnH2G0Q; 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 a640c23a62f3a-a6fcf460f11si321711466b.211.2024.06.23.16.01.59; Sun, 23 Jun 2024 16:02:00 -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; dkim=neutral (body hash did not verify) header.i=@niedermayer.cc header.s=gm1 header.b=pHnH2G0Q; 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 E51C768D61B; Mon, 24 Jun 2024 02:01:47 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 00E9D68D42E for ; Mon, 24 Jun 2024 02:01:40 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 3A7451BF204 for ; Sun, 23 Jun 2024 23:01:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1719183700; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qk20pUiVkb5Oo1DovfyhpqnOtcfrCMaRHvN3YGnVH7s=; b=pHnH2G0QfSdR7hTKSBEx2SUIaaNBBBr6AlDazuDcS8Xk8A+pL6TIN3oby+ipC+jHYEXjIm tjRw/06loyYom6CmOrrZzkxFyve50pNoXZ/SaqlaQDqRPVNhlO3VNoMWJz55I/N3NLBwMs LTbdaNTS3uIYLNMKSQRD6PT4WZsx/XqX8nmT+1GhHP+2FF50uB0rOExx6ohWUbcP+yfnYd gaAKsI+80TH8BT4aXoVj6Nn42PLzpofBmp5gCiS1HGAWQTeexCdWpnNnZRbH40c3wqQNei A3e41KGwmMwHR01indokEecqWfqWPEWUGiSTstH/EqZFFDYxG7QzrFpsEBm0+Q== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Mon, 24 Jun 2024 01:01:34 +0200 Message-ID: <20240623230137.1749178-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240623230137.1749178-1-michael@niedermayer.cc> References: <20240623230137.1749178-1-michael@niedermayer.cc> MIME-Version: 1.0 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 2/5] avcodec/hevc/hevcdec: Do not allow changes to parameter sets between 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: jPw7mA7Oi+ZO The slice code detects changes by comparing the pps index. That way the code cannot detect changes if the sets can change. Fixes: out of array access Fixes: 69585/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-6389604524556288 Fixes: 69601/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5069068613255168 Fixes: 69621/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-6187334182174720 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/hevc/hevcdec.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c index 1d2e53afc32..d68d454537a 100644 --- a/libavcodec/hevc/hevcdec.c +++ b/libavcodec/hevc/hevcdec.c @@ -3221,17 +3221,20 @@ static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal) ret = ff_hevc_decode_nal_vps(&gb, s->avctx, &s->ps); if (ret < 0) goto fail; + s->sh.pps_id = -1; break; case HEVC_NAL_SPS: ret = ff_hevc_decode_nal_sps(&gb, s->avctx, &s->ps, s->apply_defdispwin); if (ret < 0) goto fail; + s->sh.pps_id = -1; break; case HEVC_NAL_PPS: ret = ff_hevc_decode_nal_pps(&gb, s->avctx, &s->ps); if (ret < 0) goto fail; + s->sh.pps_id = -1; break; case HEVC_NAL_SEI_PREFIX: case HEVC_NAL_SEI_SUFFIX: