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 > --- > 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.