PR #22853 opened by toots URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22853 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22853.patch
>From 9e5a6d65ad6ebca8e66e1d68c594f411401a81b5 Mon Sep 17 00:00:00 2001 From: Romain Beauxis <[email protected]> Date: Sat, 18 Apr 2026 09:14:50 -0500 Subject: [PATCH] libavdevice/alsa.c: fix NULL pointer dereference --- libavdevice/alsa.c | 7 +++++-- tests/fate/libavdevice.mak | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/libavdevice/alsa.c b/libavdevice/alsa.c index 9d8239c962b..e7d66dcc9a7 100644 --- a/libavdevice/alsa.c +++ b/libavdevice/alsa.c @@ -377,14 +377,17 @@ int ff_alsa_get_device_list(AVDeviceInfoList *device_list, snd_pcm_stream_t stre name = snd_device_name_get_hint(*n, "NAME"); descr = snd_device_name_get_hint(*n, "DESC"); io = snd_device_name_get_hint(*n, "IOID"); + if (!io || !strcmp(io, filter)) { new_device = av_mallocz(sizeof(AVDeviceInfo)); if (!new_device) { ret = AVERROR(ENOMEM); goto fail; } - new_device->device_name = av_strdup(name); - if ((tmp = strrchr(descr, '\n')) && tmp[1]) + new_device->device_name = av_strdup(name ? name : ""); + if (!descr) + new_device->device_description = av_strdup(""); + else if ((tmp = strrchr(descr, '\n')) && tmp[1]) new_device->device_description = av_strdup(&tmp[1]); else new_device->device_description = av_strdup(descr); diff --git a/tests/fate/libavdevice.mak b/tests/fate/libavdevice.mak index e983327a502..9e860b70e07 100644 --- a/tests/fate/libavdevice.mak +++ b/tests/fate/libavdevice.mak @@ -2,5 +2,9 @@ FATE_LIBAVDEVICE-$(CONFIG_JACK_INDEV) += fate-timefilter fate-timefilter: libavdevice/tests/timefilter$(EXESUF) fate-timefilter: CMD = run libavdevice/tests/timefilter +FATE_SAMPLES_FFMPEG-$(CONFIG_ALSA_INDEV) += fate-alsa-device-list-nodesc +fate-alsa-device-list-nodesc: CMD = (export ALSA_CONFIG_PATH=$(TARGET_SAMPLES)/alsa/alsa_nodesc.conf && ffmpeg -sources alsa) +fate-alsa-device-list-nodesc: CMP = null + FATE-$(CONFIG_AVDEVICE) += $(FATE_LIBAVDEVICE-yes) fate-libavdevice: $(FATE_LIBAVDEVICE-yes) -- 2.52.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
