[pulseaudio-discuss] [PATCH v2 4/6] source-output: Avoid potential NULL dereference
Peter Meerwald-Stadler
pmeerw at pmeerw.net
Tue Aug 30 13:04:33 UTC 2016
if data->source is NULL, pa_source_output_new_data_set_source() may fail to set data->source;
the false retval is ignored, leading to a NULL dereference in pa_source_get_state(data->source) below
CID 1323590
---
src/pulsecore/source-output.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/pulsecore/source-output.c b/src/pulsecore/source-output.c
index 35ef1c5..e0fb660 100644
--- a/src/pulsecore/source-output.c
+++ b/src/pulsecore/source-output.c
@@ -279,7 +279,7 @@ int pa_source_output_new(
if (!data->format && data->nego_formats && !pa_idxset_isempty(data->nego_formats))
data->format = pa_format_info_copy(pa_idxset_first(data->nego_formats, NULL));
- if (PA_LIKELY(data->format)) {
+ if (PA_LIKELY(data->format) && PA_LIKELY(data->source)) {
pa_log_debug("Negotiated format: %s", pa_format_info_snprint(fmt, sizeof(fmt), data->format));
} else {
pa_format_info *format;
--
1.7.10.4
More information about the pulseaudio-discuss
mailing list