[pulseaudio-discuss] [PATCH 4/6] source-output: Avoid potential NULL dereference

Peter Meerwald-Stadler pmeerw at pmeerw.net
Thu Aug 18 16:17:09 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 | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/pulsecore/source-output.c b/src/pulsecore/source-output.c
index 35ef1c5..d6a1d57 100644
--- a/src/pulsecore/source-output.c
+++ b/src/pulsecore/source-output.c
@@ -271,7 +271,8 @@ int pa_source_output_new(
             pa_return_val_if_fail(source, -PA_ERR_NOENTITY);
         }
 
-        pa_source_output_new_data_set_source(data, source, false);
+        if (!pa_source_output_new_data_set_source(data, source, false))
+            return -PA_ERR_NOTSUPPORTED;
     }
 
     /* If something didn't pick a format for us, pick the top-most format since
-- 
2.7.4



More information about the pulseaudio-discuss mailing list