From patchwork Sun Jun 9 15:05:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Haas X-Patchwork-Id: 49750 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:c209:0:b0:460:55fa:d5ed with SMTP id d9csp2052594vqo; Sun, 9 Jun 2024 08:07:19 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVDpa1zPodUaCpw30wFNSmAO4gHrZW0JuHO/SEwnQwdGfQZlvHLA/01EUJrbES7MQ4ogb3Qb/DB6eHuA9FH2giW9AE+n85wu2S7wQ== X-Google-Smtp-Source: AGHT+IHIJekoNmiC4qxvY1szkJ7tDn4gUkAdHgZuxR/IJcSwUkq3IwbaWvb3QnhyU7vYJ2t0WLE9 X-Received: by 2002:a50:931a:0:b0:57c:6144:2dca with SMTP id 4fb4d7f45d1cf-57c61442e61mr2900068a12.9.1717945639577; Sun, 09 Jun 2024 08:07:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1717945639; cv=none; d=google.com; s=arc-20160816; b=YgFxywBkeM3j+n/k1sc3iyXuWHf7Zrxn1RgvwJp6hagIdREf/9zoHD87B1K8bmmGNn xafeGWM4obszItUhm4MjfKWc6CGNa7k8nDho/WtRZMkLVyfJl0cTQ1YvQEYR6QJfPUvj BECsG5WkRH8nwNEPYaqN4CWuXjB0blAjWP0kQbASGIH0WliG0vry3LaYHXSJh0u2Fx4a 12D7Fe9/1TETm+pafHFLNE4cF4Z2AvGLVPsPxclWz4PSl5LkXhJPV9uZQun8PZSH2AIB mCqleu0U/Oc2dnPm/Whqy/rMKfZvxIJxJZif0PpO1tBDqrU0GUoEReDcl00mQq+gQuD5 5HuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc: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=430jRdwFU9ySmwlH0qQCJA9bmbRYM+SIaM2q+1g4o6c=; fh=xmAeKtysnShNOmkhiJmYkS30uw4Fu2hvBJ7qlIwukxQ=; b=w4hZxckzmC1eopHTbnUClf95HFB58rUg0wdeO2w4LM49/RR0n52jJdO/9Qu8eVEmRN IxHDSLB7vYYSQtxU71yCyDoLXyYSHTA9xmApcWWCQsRxiAAlznl9M+sbcPm5Fq6AiI4Y /OOFmpsj6d8vEUXTB+cNH5k3BymEAqhzm43DuvOBHPaaW5Jh0icykPzboku1sXA9p+v5 LKg4pUKWe1Us4h39DuiG/yZSSaE/ymuD1QjIM3fbHFZOnzzNeRvOr/W+LrV3mij17kvy BWrMwzoBMW7rZuv4fBIw42TbicSITbfIMKF7WeVJhGIeX1pVFuw1BKlLrGHKU21u+QIl gf3Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@haasn.xyz header.s=mail header.b=AdGsbda9; 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 4fb4d7f45d1cf-57c6781e6besi1915504a12.103.2024.06.09.08.07.19; Sun, 09 Jun 2024 08:07:19 -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=@haasn.xyz header.s=mail header.b=AdGsbda9; 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 3938568D5FA; Sun, 9 Jun 2024 18:06:15 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from haasn.dev (haasn.dev [78.46.187.166]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E3B0E68D3A3 for ; Sun, 9 Jun 2024 18:06:03 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=haasn.xyz; s=mail; t=1717945558; bh=Du+iida1rErpDRc+CYfTSG6BzafPCMjWsovO7VqYsW4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AdGsbda9fuTqL28RsZVNudQ9kr0QiFPuowU0bKbeShqk+FEj6hrWvuITgz3wLCiX4 Vz3KUe/U6iHo2hFgGCrx2BH1kz7Kb2m2V9Q4TX8Mqb95mgD+SN3RQMi6xl3H0acc/y rkNv8CxAfMOYoA5Zu0A8eUU/dRLW3R91SdrOtbl0= Received: from haasn.dev (unknown [10.30.0.2]) by haasn.dev (Postfix) with ESMTP id 5449943E93; Sun, 9 Jun 2024 17:05:58 +0200 (CEST) From: Niklas Haas To: ffmpeg-devel@ffmpeg.org Date: Sun, 9 Jun 2024 17:05:52 +0200 Message-ID: <20240609150553.72865-7-ffmpeg@haasn.xyz> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240609150553.72865-1-ffmpeg@haasn.xyz> References: <20240609150553.72865-1-ffmpeg@haasn.xyz> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 7/8] avcodec/dovi_rpudec: reject reserved_zero_3bits != 0 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 Cc: Niklas Haas Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: ofjhGErpocmA From: Niklas Haas This is used by future versions of the spec to implement metadata compression. Given that we don't yet implement that spec, validate that this is equal to 0 for now. --- libavcodec/dovi_rpudec.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavcodec/dovi_rpudec.c b/libavcodec/dovi_rpudec.c index 064d74575f..e947870d45 100644 --- a/libavcodec/dovi_rpudec.c +++ b/libavcodec/dovi_rpudec.c @@ -412,6 +412,7 @@ int ff_dovi_rpu_parse(DOVIContext *s, const uint8_t *rpu, size_t rpu_size, int bl_bit_depth_minus8 = get_ue_golomb_31(gb); int el_bit_depth_minus8 = get_ue_golomb_31(gb); int vdr_bit_depth_minus8 = get_ue_golomb_31(gb); + int reserved_zero_3bits; VALIDATE(bl_bit_depth_minus8, 0, 8); VALIDATE(el_bit_depth_minus8, 0, 8); VALIDATE(vdr_bit_depth_minus8, 0, 8); @@ -419,7 +420,8 @@ int ff_dovi_rpu_parse(DOVIContext *s, const uint8_t *rpu, size_t rpu_size, hdr->el_bit_depth = el_bit_depth_minus8 + 8; hdr->vdr_bit_depth = vdr_bit_depth_minus8 + 8; hdr->spatial_resampling_filter_flag = get_bits1(gb); - skip_bits(gb, 3); /* reserved_zero_3bits */ + reserved_zero_3bits = get_bits(gb, 3); + VALIDATE(reserved_zero_3bits, 0, 0); hdr->el_spatial_resampling_filter_flag = get_bits1(gb); hdr->disable_residual_flag = get_bits1(gb); }