PR #22871 opened by Diego de Souza (ddesouza)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22871
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22871.patch

AV1CodecConfigurationRecord may contain only the 4-byte header and no
configOBUs. Still skip the header in that case so only configOBUs are
passed to cuvidParseVideoData().

Otherwise the av1C header itself is treated as sequence header data
and AV1 decoding can fail with an unknown error.

Suggested-by: Aniket Dhok <[email protected]>
Signed-off-by: Diego de Souza <[email protected]>


>From 7c6a2dca4874582b53cce24801e5724eabd4d032 Mon Sep 17 00:00:00 2001
From: Diego de Souza <[email protected]>
Date: Tue, 21 Apr 2026 15:34:13 +0200
Subject: [PATCH] avcodec/cuviddec: handle 4-byte AV1CodecConfigurationRecord

AV1CodecConfigurationRecord may contain only the 4-byte header and no
configOBUs. Still skip the header in that case so only configOBUs are
passed to cuvidParseVideoData().

Otherwise the av1C header itself is treated as sequence header data
and AV1 decoding can fail with an unknown error.

Suggested-by: Aniket Dhok <[email protected]>
Signed-off-by: Diego de Souza <[email protected]>
---
 libavcodec/cuviddec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/cuviddec.c b/libavcodec/cuviddec.c
index be183fce35..fa1494cad4 100644
--- a/libavcodec/cuviddec.c
+++ b/libavcodec/cuviddec.c
@@ -1103,7 +1103,7 @@ static av_cold int cuvid_decode_init(AVCodecContext 
*avctx)
     // Skip first 4 bytes of AV1CodecConfigurationRecord to keep configOBUs
     // only, otherwise cuvidParseVideoData report unknown error.
     if (avctx->codec->id == AV_CODEC_ID_AV1 &&
-            extradata_size > 4 &&
+            extradata_size >= 4 &&
             extradata[0] & 0x80) {
         extradata += 4;
         extradata_size -= 4;
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to