asyncDialogBox: lock box in fdWrite to prevent a uaf (#10759)

This commit is contained in:
Vaxry
2025-06-16 17:02:08 +02:00
committed by GitHub
parent d4e8a44087
commit aba2cfe7a8
2 changed files with 10 additions and 1 deletions

View File

@@ -46,6 +46,9 @@ CAsyncDialogBox::CAsyncDialogBox(const std::string& title, const std::string& de
static int onFdWrite(int fd, uint32_t mask, void* data) {
auto box = (CAsyncDialogBox*)data;
// lock the box to prevent a UAF
auto lock = box->lockSelf();
box->onWrite(fd, mask);
return 0;
@@ -142,4 +145,8 @@ void CAsyncDialogBox::kill() {
bool CAsyncDialogBox::isRunning() const {
return m_readEventSource;
}
}
SP<CAsyncDialogBox> CAsyncDialogBox::lockSelf() {
return m_selfWeakReference.lock();
}

View File

@@ -27,6 +27,8 @@ class CAsyncDialogBox {
void kill();
bool isRunning() const;
SP<CAsyncDialogBox> lockSelf();
// focus priority, only permission popups
bool m_priority = false;