asyncDialogBox: lock box in fdWrite to prevent a uaf (#10759)
This commit is contained in:
parent
d4e8a44087
commit
aba2cfe7a8
2 changed files with 10 additions and 1 deletions
|
|
@ -46,6 +46,9 @@ CAsyncDialogBox::CAsyncDialogBox(const std::string& title, const std::string& de
|
||||||
static int onFdWrite(int fd, uint32_t mask, void* data) {
|
static int onFdWrite(int fd, uint32_t mask, void* data) {
|
||||||
auto box = (CAsyncDialogBox*)data;
|
auto box = (CAsyncDialogBox*)data;
|
||||||
|
|
||||||
|
// lock the box to prevent a UAF
|
||||||
|
auto lock = box->lockSelf();
|
||||||
|
|
||||||
box->onWrite(fd, mask);
|
box->onWrite(fd, mask);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -143,3 +146,7 @@ void CAsyncDialogBox::kill() {
|
||||||
bool CAsyncDialogBox::isRunning() const {
|
bool CAsyncDialogBox::isRunning() const {
|
||||||
return m_readEventSource;
|
return m_readEventSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SP<CAsyncDialogBox> CAsyncDialogBox::lockSelf() {
|
||||||
|
return m_selfWeakReference.lock();
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,8 @@ class CAsyncDialogBox {
|
||||||
void kill();
|
void kill();
|
||||||
bool isRunning() const;
|
bool isRunning() const;
|
||||||
|
|
||||||
|
SP<CAsyncDialogBox> lockSelf();
|
||||||
|
|
||||||
// focus priority, only permission popups
|
// focus priority, only permission popups
|
||||||
bool m_priority = false;
|
bool m_priority = false;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue