From 87a72559548cb60c0114fb7b2539c6cec301c91b Mon Sep 17 00:00:00 2001 From: Vaxry Date: Tue, 20 Feb 2024 01:38:02 +0000 Subject: [PATCH] core: fix UAF faults around lock surfaces --- src/core/LockSurface.cpp | 6 ++++++ src/core/hyprlock.cpp | 2 ++ 2 files changed, 8 insertions(+) diff --git a/src/core/LockSurface.cpp b/src/core/LockSurface.cpp index af2563c..695ad21 100644 --- a/src/core/LockSurface.cpp +++ b/src/core/LockSurface.cpp @@ -31,6 +31,8 @@ CSessionLockSurface::~CSessionLockSurface() { wl_egl_window_destroy(eglWindow); ext_session_lock_surface_v1_destroy(lockSurface); wl_surface_destroy(surface); + if (frameCallback) + wl_callback_destroy(frameCallback); } CSessionLockSurface::CSessionLockSurface(COutput* output) : output(output) { @@ -116,6 +118,10 @@ void CSessionLockSurface::configure(const Vector2D& size_, uint32_t serial_) { static void handleDone(void* data, wl_callback* wl_callback, uint32_t callback_data) { const auto PSURF = (CSessionLockSurface*)data; + + if (g_pHyprlock->m_bTerminate) + return; + PSURF->onCallback(); } diff --git a/src/core/hyprlock.cpp b/src/core/hyprlock.cpp index 8fc9e31..80c0762 100644 --- a/src/core/hyprlock.cpp +++ b/src/core/hyprlock.cpp @@ -239,6 +239,8 @@ void CHyprlock::run() { m_sLoopState.timerCV.notify_all(); g_pRenderer->asyncResourceGatherer->notify(); + m_vOutputs.clear(); + wl_display_disconnect(m_sWaylandState.display); Debug::log(LOG, "Reached the end, exiting");