Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(447)

Unified Diff: third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.h

Issue 2478113002: Fix UAF in closures posted from InProcessWorkerObjectProxy (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.h
diff --git a/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.h b/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.h
index a59dffdc856554915aba5e9e7b73ab3fd32627c8..e1ee9a316a7b8f0e2396018c780eaa28127ee5a8 100644
--- a/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.h
+++ b/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.h
@@ -64,7 +64,7 @@ class CORE_EXPORT InProcessWorkerObjectProxy : public WorkerReportingProxy {
public:
static std::unique_ptr<InProcessWorkerObjectProxy> create(
- InProcessWorkerMessagingProxy*);
+ const WeakPtr<InProcessWorkerMessagingProxy>&);
~InProcessWorkerObjectProxy() override;
void postMessageToWorkerObject(PassRefPtr<SerializedScriptValue>,
@@ -89,7 +89,7 @@ class CORE_EXPORT InProcessWorkerObjectProxy : public WorkerReportingProxy {
void didTerminateWorkerThread() override;
protected:
- InProcessWorkerObjectProxy(InProcessWorkerMessagingProxy*);
+ InProcessWorkerObjectProxy(const WeakPtr<InProcessWorkerMessagingProxy>&);
virtual ExecutionContext* getExecutionContext();
private:
@@ -103,6 +103,11 @@ class CORE_EXPORT InProcessWorkerObjectProxy : public WorkerReportingProxy {
// This object always outlives this proxy.
InProcessWorkerMessagingProxy* m_messagingProxy;
+ // No guarantees about the lifetimes of tasks posted by this proxy wrt the
+ // InProcessWorkerMessagingProxy so a weak pointer must be used when posting
+ // the tasks.
+ WeakPtr<InProcessWorkerMessagingProxy> m_messagingProxyWeakPtr;
+
// Used for checking pending activities on the worker global scope. This is
// cancelled when the worker global scope is destroyed.
std::unique_ptr<Timer<InProcessWorkerObjectProxy>> m_timer;

Powered by Google App Engine
This is Rietveld 408576698