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 62DBC490B2 for ; Mon, 1 Jul 2024 18:06:11 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0A25068D72D; Mon, 1 Jul 2024 21:06:09 +0300 (EEST) Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id AADC868D5B2 for ; Mon, 1 Jul 2024 21:06:02 +0300 (EEST) Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-7066463c841so2027411b3a.1 for ; Mon, 01 Jul 2024 11:06:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719857160; x=1720461960; darn=ffmpeg.org; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=uVvQ67kPLK1EF1ZIg5PabA2HXOQw4WMOBxAfbUw25M0=; b=DalJgyDp5PgZol/KVzzOo0mkwVzkhIGMJuHsz87WxFhB9bs7uW+bagW5C4JfpcShuu OjzMUBeOHJKZaz2Qdxg5vE9tny1lycLNW4VvTkxpVpYHk0X6Xt8eOYsJO6+j/QEKG5Sr cT5Ksuk0hfK+YlAJ0heUDC8aukDKbUBvb2AqIj6aD7N3jbSCPik5uQq9bvRWWJRpEwiD fqiijgWKD+NMTkH2rvPIND6+4elijHrdv8k8XJMSJSrFLdPmeX0RLqTr9wKWVg3iVw+C nv3RGeaSo1yJcJUamMymU0WDScrQD+IbYeFvj0Yd5j3Fog5+rxFNAhzwjJ649CMK9HlQ vQ1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719857160; x=1720461960; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=uVvQ67kPLK1EF1ZIg5PabA2HXOQw4WMOBxAfbUw25M0=; b=i1b/SdRIwnOfI9EEPkPD2QqlgHScV73NefW4X+BOD7oNiRVl+Lsi9dUVkOYbC971hj /Vir4B8aERec4aowwTzo/BXnqMPx5CPjBSCsI7aEtQMFthWmIf8YwBO4RaWmtSodATrK eGIU7q/hjYMbEFLcBHKbqCbolRpwQTIf7O+cFFtF5+xBZAqPXEOIEAPfvSi40gI/8gds iwC3d5qAbZVCNG3+S78ckckb0UJcyEaN9p9tEvFJ8Ouy3jJhuXKDGSCjjQRr6q5aiWB5 C2cWmF1reSpbka6G9nE08u+1zWYTE10rsHZBS1GOqEQBbtk1qIpn/rVZ44WcJQ1q/pMf 6zRw== X-Gm-Message-State: AOJu0Yx4tX8qqEnlvXLrfmgguawlWPfFWlrGMlhseiYhFikVA2r2t6je znNQappbVvBYKqbie8Fvdr9zl4t9/q7g3JACTm63bhb4xkX6aB2U0/qedjng04qWgF9jiQ7Xn4j KLT/BwTQ7iKPWCxpkmsMsTv/SKNwy7A== X-Google-Smtp-Source: AGHT+IFitcyOBvpsW0/EYxVf8T2Mxtvo5BDZELftPgIbKc6eDb/cldn6/Lb6udRr7ptanMOYRJn2idD2NVHcH2bW/zU= X-Received: by 2002:a05:6a21:3387:b0:1bd:226e:4968 with SMTP id adf61e73a8af0-1bef61ff37bmr5901678637.45.1719857159982; Mon, 01 Jul 2024 11:05:59 -0700 (PDT) MIME-Version: 1.0 References: <20240621003355.3301-1-joshua.allmann@gmail.com> In-Reply-To: From: Dennis Mungai Date: Mon, 1 Jul 2024 21:05:22 +0300 Message-ID: To: FFmpeg development discussions and patches X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: Re: [FFmpeg-devel] [PATCH] avcodec/nvenc: Fix segfault with intra-only 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-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: On Mon, 1 Jul 2024 at 21:01, Timo Rothenpieler wrote: > On 01.07.2024 18:52, Josh Allmann wrote: > > On Thu, 20 Jun 2024 at 17:39, Josh Allmann > wrote: > >> > >> In intra-only mode, frameIntervalP is 0, which means the frame > >> data array is smaller than the number of surfaces. This causes a > >> crash when closing the encoder. > >> > >> Fix this by making sure the frame data array is at least as big as > >> the number of surfaces. > >> --- > >> libavcodec/nvenc.c | 2 +- > >> 1 file changed, 1 insertion(+), 1 deletion(-) > >> > >> diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c > >> index a9945355ba..93e87b21db 100644 > >> --- a/libavcodec/nvenc.c > >> +++ b/libavcodec/nvenc.c > >> @@ -1021,7 +1021,7 @@ static av_cold int > nvenc_recalc_surfaces(AVCodecContext *avctx) > >> > >> // Output in the worst case will only start when the surface > buffer is completely full. > >> // Hence we need to keep at least the max amount of surfaces plus > the max reorder delay around. > >> - ctx->frame_data_array_nb = ctx->nb_surfaces + > ctx->encode_config.frameIntervalP - 1; > >> + ctx->frame_data_array_nb = FFMAX(ctx->nb_surfaces, > ctx->nb_surfaces + ctx->encode_config.frameIntervalP - 1); > >> > >> return 0; > >> } > >> -- > >> 2.39.2 > >> > > > > Hello, > > > > Ping for review. This patch fixes an easily triggered crash with nvenc > > in intra-only mode, eg > > > > ffmpeg -i -c:v h264_nvenc -g 0 > > > > Josh > Can this also be back-ported to FFmpeg 7.x upon merging? _______________________________________________ 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".