From ef737641de42c41c4d3dc6a026974177bd287baa Mon Sep 17 00:00:00 2001 From: David Reid Date: Mon, 29 Aug 2022 09:57:35 +1000 Subject: [PATCH] PulseAudio: Add a null pointer check for safety. Public issue https://github.com/mackron/miniaudio/issues/527 --- miniaudio.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/miniaudio.h b/miniaudio.h index c2785563..ded9c480 100644 --- a/miniaudio.h +++ b/miniaudio.h @@ -28331,6 +28331,14 @@ static void ma_device_sink_info_callback(ma_pa_context* pPulseContext, const ma_ return; } + /* + There has been a report that indicates that pInfo can be null which results + in a null pointer dereference below. We'll check for this for safety. + */ + if (pInfo == NULL) { + return; + } + pInfoOut = (ma_pa_sink_info*)pUserData; MA_ASSERT(pInfoOut != NULL); @@ -28347,6 +28355,14 @@ static void ma_device_source_info_callback(ma_pa_context* pPulseContext, const m return; } + /* + There has been a report that indicates that pInfo can be null which results + in a null pointer dereference below. We'll check for this for safety. + */ + if (pInfo == NULL) { + return; + } + pInfoOut = (ma_pa_source_info*)pUserData; MA_ASSERT(pInfoOut != NULL);