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 6E0E1431F9 for ; Fri, 24 Jun 2022 12:06:44 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5AA8868B6E6; Fri, 24 Jun 2022 15:06:42 +0300 (EEST) Received: from mail-oa1-f42.google.com (mail-oa1-f42.google.com [209.85.160.42]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B42D7680195 for ; Fri, 24 Jun 2022 15:06:35 +0300 (EEST) Received: by mail-oa1-f42.google.com with SMTP id 586e51a60fabf-1013ecaf7e0so3419039fac.13 for ; Fri, 24 Jun 2022 05:06:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :references:from:in-reply-to:content-transfer-encoding; bh=PTteY/lsd01y0TQowhgW0bXHNQ3LjAdfuGJ73p2HkqQ=; b=WjbaOmX60iYaWFSe+k4VRL3jKLnUi85TOSDS0uGCx1WSSvgYmUnzJYPr0sJS4OenLf GX4ZnDnXGH/4XDO4FTjuw2x+X0jw8Dp5WWtwXvTWpArqXuDXVm9qlt7EBtLHQwcQynni IntIwYVrErQdXTnzJ+TDng+63V+Nwn9hcQlEXVjYe8C3dPjz1VxEI3m4WddEnnDN0HtW mpS9KD/0T8FL71D4rt5KAkRQLpE5Vfcxa2f8QMrgL4R5b9EMY3otvPCxgeJJOPZzJQhT Ff65npkaSNNeG8PkyKHLqCTUZ6KI3LolUKP94xPAX2STxb3581mhS6W2PR901ciJMast iG9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=PTteY/lsd01y0TQowhgW0bXHNQ3LjAdfuGJ73p2HkqQ=; b=jqc0iXtR5qImR4bnSPaD1VJlFvthNkHxFdx+oLl80cRh3CE0Acrp4+KhOSYQoScka9 ez6Zm6N454M3upJRfE7XpfMH3COQNsaa/AaUdxryYuU7Bffxb4/E1q1c9vCCCulg9WhB Ffh1mHiR16J3rQemDACvXyL/rBdY9VBBCCeZ4PqJZcmhpfHSW1qOOjTOzJhZ2c7NIbRR ZpLl7sGohyMrsVnDqS+vUl0rRGfKrt2tQ2lNamYjj7XD7H0yGTjy7mk2YhSDzkffOzCk 4oqeB7rUxmNMKNTraiJiC1Brm6zy6gQ44JmX/IIJ7M7AsQe2Ld0+BvkLFMxX5SSN8FDZ Cj7Q== X-Gm-Message-State: AJIora/KCstbjDl167ptSXdDqSD9TGBz/1i8+qkwW+OfFfbTl1gT6ZRX rnGkSzW49swBr+/h/tBTRcr0azPgeec= X-Google-Smtp-Source: AGRyM1scRHU9HeoLo2rmhUYoEy5UIIGMrE/hFbdjwL3LpqfDcjNyJ49NnF7SBWRecMa2i/EnNOQ5lA== X-Received: by 2002:a05:6870:9710:b0:101:d3a2:94d1 with SMTP id n16-20020a056870971000b00101d3a294d1mr1826922oaq.180.1656072393497; Fri, 24 Jun 2022 05:06:33 -0700 (PDT) Received: from [192.168.0.13] ([186.136.131.204]) by smtp.gmail.com with ESMTPSA id t5-20020a4aa3c5000000b0035ef3da8387sm1284041ool.4.2022.06.24.05.06.32 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 24 Jun 2022 05:06:32 -0700 (PDT) Message-ID: <759c7662-ea42-0e31-d107-bbff05ff9820@gmail.com> Date: Fri, 24 Jun 2022 09:06:31 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Content-Language: en-US To: ffmpeg-devel@ffmpeg.org References: From: James Almer In-Reply-To: Subject: Re: [FFmpeg-devel] [PATCH] avcodec/cuviddec: fix AV1 decoding error 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 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 6/24/2022 1:04 AM, Zhao Zhili wrote: > From: Zhao Zhili > > cuvidParseVideoData only supports pure OBUs, it report unknown > error with AV1CodecConfigurationRecord. Check whether extradata > is AV1CodecConfigurationRecord and skip the first 4 bytes to fix > the issue. > > The bug is revealed in ffmpeg cmd since 45e3b6a68 and ffd1316e. > --- > libavcodec/cuviddec.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/libavcodec/cuviddec.c b/libavcodec/cuviddec.c > index cb3cda7e24..fc9c0515fe 100644 > --- a/libavcodec/cuviddec.c > +++ b/libavcodec/cuviddec.c > @@ -953,6 +953,16 @@ static av_cold int cuvid_decode_init(AVCodecContext *avctx) > extradata_size = avctx->extradata_size; > } > > + // Check first bit to determine whether it's AV1CodecConfigurationRecord. > + // 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 && extradata[0] & 0x80) { IMO the check for extradata here is unnecessary as the memcpy dereferencing it below will crash anyway if it were NULL. If anything, a check like (avctx->extradata_size || !avctx->extradata) should be added to avcodec_open2() if there isn't one already to ensure the user set up valid extradata when opening a decoder. > + extradata += 4; > + extradata_size -= 4; > + } > + > ctx->cuparse_ext = av_mallocz(sizeof(*ctx->cuparse_ext) > + FFMAX(extradata_size - (int)sizeof(ctx->cuparse_ext->raw_seqhdr_data), 0)); > if (!ctx->cuparse_ext) { LGTM either way. _______________________________________________ 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".