Skip to content

Commit

Permalink
Merge pull request #3768 from deprekated/fix_privacy_null_deref
Browse files Browse the repository at this point in the history
fix null-deref due to unconstructed PrivacyNodeInfo
  • Loading branch information
Alexays authored Nov 20, 2024
2 parents b863627 + 86ce9f7 commit 20ca48c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/util/pipewire/pipewire_backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ void PipewireBackend::handleRegistryEventGlobal(uint32_t id, uint32_t permission
if (proxy == nullptr) return;

auto *pNodeInfo = (PrivacyNodeInfo *)pw_proxy_get_user_data(proxy);
new(pNodeInfo) PrivacyNodeInfo{};
pNodeInfo->id = id;
pNodeInfo->data = this;
pNodeInfo->type = mediaType;
Expand All @@ -142,6 +143,7 @@ void PipewireBackend::handleRegistryEventGlobalRemove(uint32_t id) {
mutex_.lock();
auto iter = privacy_nodes.find(id);
if (iter != privacy_nodes.end()) {
privacy_nodes[id]->~PrivacyNodeInfo();
privacy_nodes.erase(id);
}
mutex_.unlock();
Expand Down

0 comments on commit 20ca48c

Please sign in to comment.