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 80BDC47A9E for ; Sun, 28 Jul 2024 10:25:54 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 10EEA68D8EE; Sun, 28 Jul 2024 13:25:44 +0300 (EEST) Received: from haasn.dev (haasn.dev [78.46.187.166]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 496E268D726 for ; Sun, 28 Jul 2024 13:25:36 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=haasn.xyz; s=mail; t=1722162335; bh=CLG6GHjRjzZ39wdLbq0ic1/QGueqBigHkbCCFhVPPI4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dupfiPlvo4eLX3sbFv+fItq9Aa4vJHiY1Kk+Butb2TFa7dDE8mWiw2Qyq23V8qdUZ X48/dKq8gJzEhrjl4JDRq5zyfFbfon8noItZ/9qFyRODeUEpRsWz9LM/pRRFb4vw6R hFakeI3W0QX3yOHCZQZs1snGQC7HoKBNqQX6Sjxw= Received: from haasn.dev (unknown [10.30.0.2]) by haasn.dev (Postfix) with ESMTP id A350C41E70; Sun, 28 Jul 2024 12:25:35 +0200 (CEST) From: Niklas Haas To: ffmpeg-devel@ffmpeg.org Date: Sun, 28 Jul 2024 12:25:07 +0200 Message-ID: <20240728102527.17991-2-ffmpeg@haasn.xyz> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240728102527.17991-1-ffmpeg@haasn.xyz> References: <20240728102527.17991-1-ffmpeg@haasn.xyz> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 02/22] avcodec/dovi_rpudec: implement validation for compression 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 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: From: Niklas Haas Add some error checking. I've limited it to AV_EF_CAREFUL and AV_EF_COMPLIANT for now, because we can technically decode such RPUs just fine. --- libavcodec/dovi_rpudec.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/libavcodec/dovi_rpudec.c b/libavcodec/dovi_rpudec.c index 375e6e560b..bf6e5075d1 100644 --- a/libavcodec/dovi_rpudec.c +++ b/libavcodec/dovi_rpudec.c @@ -314,6 +314,7 @@ int ff_dovi_rpu_parse(DOVIContext *s, const uint8_t *rpu, size_t rpu_size, uint8_t use_prev_vdr_rpu; uint8_t use_nlq; uint8_t profile; + uint8_t compression = s->cfg.dv_profile ? s->cfg.dv_md_compression : 0; if (rpu_size < 5) return AVERROR_INVALIDDATA; @@ -459,6 +460,20 @@ int ff_dovi_rpu_parse(DOVIContext *s, const uint8_t *rpu, size_t rpu_size, return AVERROR_INVALIDDATA; } + if (err_recognition & (AV_EF_COMPLIANT | AV_EF_CAREFUL)) { + if (profile < 8 && compression) { + av_log(s->logctx, AV_LOG_ERROR, "Profile %d RPUs should not use " + "metadata compression.", profile); + return AVERROR_INVALIDDATA; + } + + if (use_prev_vdr_rpu && !compression) { + av_log(s->logctx, AV_LOG_ERROR, "Uncompressed RPUs should not have " + "use_prev_vdr_rpu=1\n"); + return AVERROR_INVALIDDATA; + } + } + if (use_prev_vdr_rpu) { int prev_vdr_rpu_id = get_ue_golomb_31(gb); VALIDATE(prev_vdr_rpu_id, 0, DOVI_MAX_DM_ID); -- 2.45.2 _______________________________________________ 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".