Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Timo Rothenpieler via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: Timo Rothenpieler <timo@rothenpieler.org>
Subject: [FFmpeg-devel] Re: [PATCH] avutil/cuda_check: add error handling to ff_cuda_check
Date: Thu, 11 Dec 2025 18:52:43 +0100
Message-ID: <a3eb7cc8-e1f6-4bd3-a8e4-d18aec09e47f@rothenpieler.org> (raw)
In-Reply-To: <b0229e2564d44e19b4d18e7ae6a47ab2@valvesoftware.com>


[-- Attachment #1.1.1.1: Type: text/plain, Size: 2033 bytes --]

On 11.12.2025 03:51, Chris Boyd via ffmpeg-devel wrote:
> Add variable initialization and return value checks when calling
> cuGetErrorName() and cuGetErrorString(). Although the documentation for
> these methods seems to imply that the provided char* will be set to NULL
> on failure, we have seen crashes when logging these strings with
> uninitialized memory on machines that have Nvidia drivers installed but
> no longer have an Nvidia GPU.
> 
> Signed-off-by: Christopher Boyd <cboyd@valvesoftware.com>
> ---
>   libavutil/cuda_check.h | 14 ++++++++++----
>   1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/libavutil/cuda_check.h b/libavutil/cuda_check.h
> index f5a9234eaf..763009ce92 100644
> --- a/libavutil/cuda_check.h
> +++ b/libavutil/cuda_check.h
> @@ -33,16 +33,22 @@ static inline int ff_cuda_check(void *avctx,
>                                   void *cuGetErrorName_fn, void *cuGetErrorString_fn,
>                                   CUresult err, const char *func)
>   {
> -    const char *err_name;
> -    const char *err_string;
> +    const char *err_name = NULL;
> +    const char *err_string = NULL;
> +    CUresult get_err;
>   
>       av_log(avctx, AV_LOG_TRACE, "Calling %s\n", func);
>   
>       if (err == CUDA_SUCCESS)
>           return 0;
>   
> -    ((cuda_check_GetErrorName *)cuGetErrorName_fn)(err, &err_name);
> -    ((cuda_check_GetErrorString *)cuGetErrorString_fn)(err, &err_string);
> +    get_err = ((cuda_check_GetErrorName *)cuGetErrorName_fn)(err, &err_name);
> +    if (get_err != CUDA_SUCCESS)
> +        err_name = NULL;
> +
> +    get_err = ((cuda_check_GetErrorString *)cuGetErrorString_fn)(err, &err_string);
> +    if (get_err != CUDA_SUCCESS)
> +        err_string = NULL;
>   
>       av_log(avctx, AV_LOG_ERROR, "%s failed", func);
>       if (err_name && err_string)

LGTM

fyi: You can also submit patches to 
https://code.ffmpeg.org/FFmpeg/FFmpeg as PR now, and development is 
rapidly shifting to that.

[-- Attachment #1.1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3203 bytes --]

[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

[-- Attachment #2: Type: text/plain, Size: 163 bytes --]

_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org

      reply	other threads:[~2025-12-11 17:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-11  2:51 [FFmpeg-devel] " Chris Boyd via ffmpeg-devel
2025-12-11 17:52 ` Timo Rothenpieler via ffmpeg-devel [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a3eb7cc8-e1f6-4bd3-a8e4-d18aec09e47f@rothenpieler.org \
    --to=ffmpeg-devel@ffmpeg.org \
    --cc=timo@rothenpieler.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git