From patchwork Thu Jul 6 15:06:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 42467 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b1e:b0:12b:9ae3:586d with SMTP id c30csp6590521pzh; Thu, 6 Jul 2023 08:06:37 -0700 (PDT) X-Google-Smtp-Source: APBJJlGvKvGBpM1A5JCrKyuRLNh+DUpF+PtCocC342lguOK09H1s9BFwc8xAnbzOEFHH2zP/5LYL X-Received: by 2002:a05:6402:8c4:b0:51d:b450:5e35 with SMTP id d4-20020a05640208c400b0051db4505e35mr1855711edz.15.1688655996959; Thu, 06 Jul 2023 08:06:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688655996; cv=none; d=google.com; s=arc-20160816; b=F0Pzyd6/f7XYsI0CdwoYcpE9BqPf7i5Op+e+ECFE+fpsiXiayHYL+ZwTDGDf8SyH/t TvRJW1te/G9gFMW5nyIm92J+EU9EIVwGBjz6SiVXS3uJdEhgJqxnZUyVPfGpqTUXcO8m cICP7cVJaAv8fwGnNRkiA0ZhvF66haa1f2EvahcAh//YL/JGroBBvMb4VNsfIrBDB1Ea WqWOSNBi2tgckmxDHQv6YfPksqbDEjQfGwjGzRohrA/t1RqfHivY5TkUx+R9tF6F/V7T 4BD/qwdjMs736V3eZEH/6yGy3BUhQYFJAc6OTHtJi4zN0W5SUDEIU+3okFFjXUDT9aDU S7rw== 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:message-id:date:to:from :dkim-signature:delivered-to; bh=vQvfs1rzQcubS042mJK5F5R0pUIisouU/AtLLLwFbk0=; fh=J3zlMo7rVW2t2IQYogliBcMNuBh6YQg7NRChcrschf4=; b=rddhA5a7Dz7/5ByLFvghuauvdMTdU3jHmR1uQHfmERp7pGppYzQupK1YQ1UgbucVWO 74Gx4mvmzVAmIBoF7G6BSai4oEpuiuqDJPmULynLznPAtf7vgzyef2JzFAeKYlxsGWzd ApOQl8rSvfGfzFgPewXOglQfYifzEluNmo7cFOncpWeA6YsxTuUVrFFQGbDZp6i8zPMn eeBDovZbAbzw4uMYuIuH2NHOiRV786WODlDyzBHLj6T+GspqVQyU8lX8GFyb/LCVhd3y MJwCBthUYTcEIn/jyFt1J7IAOeeXi6i1P7ZqGXd0lIq0emDhn6oyZEDSlbnQ8/y7Ccm4 1qQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20221208 header.b=NQ9vNjWM; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id z9-20020aa7cf89000000b0051df54469d3si942777edx.236.2023.07.06.08.06.31; Thu, 06 Jul 2023 08:06:36 -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=@gmail.com header.s=20221208 header.b=NQ9vNjWM; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 77A7968C5F5; Thu, 6 Jul 2023 18:06:27 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-oo1-f50.google.com (mail-oo1-f50.google.com [209.85.161.50]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6223B68C5F5 for ; Thu, 6 Jul 2023 18:06:21 +0300 (EEST) Received: by mail-oo1-f50.google.com with SMTP id 006d021491bc7-5636426c1b3so545361eaf.1 for ; Thu, 06 Jul 2023 08:06:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1688655979; x=1691247979; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=68D1zEMkDAvr0cgjQwRHV2MdbH/ScHQ2jZpBboIOtmU=; b=NQ9vNjWM7enKABhdn+x6r9lLq+C0xu+plDspCmXPQOcFhv6K4Kewf87Ctufn6YUiRD HYT/JMb2QoO7YNENtVP1TUxXEyeZVT7k+KuxmRVPWA+s0A8KTDHPETsHWPX6hJEyruYI iNDOmZ8FF+iAkUG4rLWIIG3Ienc7BddNmjOg9491a/I4ooPeZWQ312331asWiazw458A GtPJhgSIxUygHFbwxsqukgYFOUHQ3Z7urP34/fMYhqnGT0rlnbfXYVagwmlw77YnLWPE jvIPC84d+05Kf4vQRul850wS9dUY5w4FAvOPneA/LFQ7Qi/DrK1EySzEHdIJNU++rXhE noXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688655979; x=1691247979; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=68D1zEMkDAvr0cgjQwRHV2MdbH/ScHQ2jZpBboIOtmU=; b=VN8seUSCaF2M+QDwZToyY8NN367VOyjM9YJQ5vzeSKVGyWiHHSwqqgY5UTvuR1k9mo Xkpaupx7pzHGG+tv5+ReCmm2mfISZiXKbSSzA+8PrMcFo8Yw7AQTDkV1gJ1YL4LhtYaY 4yWZb2/svmV7/MDE1lq5tvk1Fb0SgUr/swwGKXmrCyEHen0KLrwPIPyViv0JZGbymCwS hqhs5eCXDcR2Bb0DE7C+dkYpJuu12rYA2+6d8tXeszJjF0+ivRCyuXIf7iSmAuA8Z2As PHhqNRZJuiPqdo8HNlyrQOuRr2PBhQTy4y9HYJRW0iJIfsV2wrGK4DhMUbOF18YYcAbA sqJg== X-Gm-Message-State: ABy/qLZRxgE4arOVO3dcltSJGsjwJWm4IvihKHEhalmL7VJNRQxg6tPj ACT680N9U2Ag7UGDylQMX3QVj35wWxo= X-Received: by 2002:a4a:4955:0:b0:566:65a4:8a5a with SMTP id z82-20020a4a4955000000b0056665a48a5amr1494738ooa.4.1688655979295; Thu, 06 Jul 2023 08:06:19 -0700 (PDT) Received: from localhost.localdomain (host197.190-225-105.telecom.net.ar. [190.225.105.197]) by smtp.gmail.com with ESMTPSA id w4-20020a056830110400b006b87f593877sm755139otq.37.2023.07.06.08.06.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jul 2023 08:06:18 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Thu, 6 Jul 2023 12:06:07 -0300 Message-ID: <20230706150608.1265-1-jamrial@gmail.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/2] avcodec/cbs_h266: fix use of uninitialized value 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: XV0gbY8+0u4E And fix the allowed range for ph_log2_diff_max_bt_min_qt_intra_slice_luma while at it. Signed-off-by: James Almer --- libavcodec/cbs_h266_syntax_template.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libavcodec/cbs_h266_syntax_template.c b/libavcodec/cbs_h266_syntax_template.c index b984a12d8f..f6aae3ac51 100644 --- a/libavcodec/cbs_h266_syntax_template.c +++ b/libavcodec/cbs_h266_syntax_template.c @@ -2730,9 +2730,14 @@ static int FUNC(picture_header) (CodedBitstreamContext *ctx, RWContext *rw, 0, FFMIN(6, ctb_log2_size_y) - min_cb_log2_size_y); ue(ph_max_mtt_hierarchy_depth_intra_slice_luma, 0, 2 * (ctb_log2_size_y - min_cb_log2_size_y)); + min_qt_log2_size_intra_y = + current->ph_log2_diff_min_qt_min_cb_intra_slice_luma + + min_cb_log2_size_y; if (current->ph_max_mtt_hierarchy_depth_intra_slice_luma != 0) { ue(ph_log2_diff_max_bt_min_qt_intra_slice_luma, - 0, ctb_log2_size_y - min_qt_log2_size_intra_y); + 0, (sps->sps_qtbtt_dual_tree_intra_flag ? + FFMIN(6, ctb_log2_size_y) : + ctb_log2_size_y) - min_qt_log2_size_intra_y); ue(ph_log2_diff_max_tt_min_qt_intra_slice_luma, 0, FFMIN(6, ctb_log2_size_y) - min_qt_log2_size_intra_y); } else { @@ -2780,9 +2785,6 @@ static int FUNC(picture_header) (CodedBitstreamContext *ctx, RWContext *rw, sps->sps_log2_diff_max_tt_min_qt_intra_slice_chroma); } - min_qt_log2_size_intra_y = - current->ph_log2_diff_min_qt_min_cb_intra_slice_luma + - min_cb_log2_size_y; if (pps->pps_cu_qp_delta_enabled_flag) ue(ph_cu_qp_delta_subdiv_intra_slice, 0, 2 * (ctb_log2_size_y - min_qt_log2_size_intra_y +