From 20c3da01f1b2bc038582eee831e4f5055b4f71ff Mon Sep 17 00:00:00 2001 From: outfoxxed Date: Sat, 21 Jun 2025 12:57:15 -0700 Subject: [PATCH] io/fileview: null watcher ptr after deletion to avoid UAF Fixes #69 --- src/io/fileview.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/io/fileview.cpp b/src/io/fileview.cpp index b6e911f9..cbe84172 100644 --- a/src/io/fileview.cpp +++ b/src/io/fileview.cpp @@ -492,7 +492,10 @@ void FileView::updatePath() { void FileView::updateWatchedFiles() { // If inotify events are sent to the watcher after deletion and deleteLater // isn't used, a use after free in the QML engine will occur. - if (this->watcher) this->watcher->deleteLater(); + if (this->watcher) { + this->watcher->deleteLater(); + this->watcher = nullptr; + } if (!this->targetPath.isEmpty() && this->bWatchChanges) { qCDebug(logFileView) << "Creating watcher for" << this << "at" << this->targetPath;