summaryrefslogtreecommitdiffstats
path: root/src/core/file_system_access/file_system_access_permission_grant_qt.cpp
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@qt.io>2023-01-13 16:00:48 +0100
committerMichal Klocek <michal.klocek@qt.io>2023-02-28 13:44:16 +0100
commit44d3935d1491359f1e829de490a2d50c046f8180 (patch)
tree71c1fc94f45ba6d8bd3b3aa947641cd5f9a74b48 /src/core/file_system_access/file_system_access_permission_grant_qt.cpp
parentb44f357d511a7af5e3e40583bcd0cbf9c20fa743 (diff)
Fix use after free in permission grant
The permission grant can become dangling pointer in origin state struct, fix it. Change-Id: If16b604a8c3c05d09ea923251dabcae73192dd7d Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit 16d3701b1dd4887cc4affb0447ee3b9b7729e7fb) Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'src/core/file_system_access/file_system_access_permission_grant_qt.cpp')
-rw-r--r--src/core/file_system_access/file_system_access_permission_grant_qt.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/core/file_system_access/file_system_access_permission_grant_qt.cpp b/src/core/file_system_access/file_system_access_permission_grant_qt.cpp
index 27f225755..b9a8f5a26 100644
--- a/src/core/file_system_access/file_system_access_permission_grant_qt.cpp
+++ b/src/core/file_system_access/file_system_access_permission_grant_qt.cpp
@@ -22,7 +22,11 @@ FileSystemAccessPermissionGrantQt::FileSystemAccessPermissionGrantQt(
: m_context(context), m_origin(origin), m_path(path), m_handleType(handle_type), m_type(type)
{
}
-
+FileSystemAccessPermissionGrantQt::~FileSystemAccessPermissionGrantQt()
+{
+ if (m_context)
+ m_context->PermissionGrantDestroyed(this);
+}
void FileSystemAccessPermissionGrantQt::RequestPermission(
content::GlobalRenderFrameHostId frame_id, UserActivationState user_activation_state,
base::OnceCallback<void(PermissionRequestOutcome)> callback)