Skip to content
Snippets Groups Projects
Commit 34b57aed authored by Guillaume Roguez's avatar Guillaume Roguez Committed by Adrien Béraud
Browse files

AudioStream: fix invalid memory access

Fix AudioStream::getDeviceName() that calls pa_stream_get_device_name()
without checking the return value.
This last can be the error -PA_ERR_NOTSUPPORTED or null for other issues.
In such cases we return an empty string.

Change-Id: Ia293ff8d93212d87c8fa5e6ce8399964044d530f
parent 93e434d3
Branches
No related tags found
No related merge requests found
...@@ -83,7 +83,10 @@ class AudioStream { ...@@ -83,7 +83,10 @@ class AudioStream {
} }
inline std::string getDeviceName() const { inline std::string getDeviceName() const {
return pa_stream_get_device_name(audiostream_); auto res = pa_stream_get_device_name(audiostream_);
if (res == reinterpret_cast<decltype(res)>(-PA_ERR_NOTSUPPORTED) or !res)
return {};
return res;
} }
bool isReady(); bool isReady();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment