Title: [247905] trunk/Source/WebKit
Revision
247905
Author
[email protected]
Date
2019-07-29 09:42:23 -0700 (Mon, 29 Jul 2019)

Log Message

Possible use-after-move under NetworkConnectionToWebProcess::resourceLoadStatisticsUpdated()
https://bugs.webkit.org/show_bug.cgi?id=200225

Reviewed by Brent Fulgham.

The code was WTFMove()-ing the method parameter inside of a loop, which means that it could
move it several times. Instead of copying the parameters, I opted into sending the statistics
only to the network session that matches this WebProcess connection.

* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::resourceLoadStatisticsUpdated):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (247904 => 247905)


--- trunk/Source/WebKit/ChangeLog	2019-07-29 14:40:16 UTC (rev 247904)
+++ trunk/Source/WebKit/ChangeLog	2019-07-29 16:42:23 UTC (rev 247905)
@@ -1,3 +1,17 @@
+2019-07-29  Chris Dumez  <[email protected]>
+
+        Possible use-after-move under NetworkConnectionToWebProcess::resourceLoadStatisticsUpdated()
+        https://bugs.webkit.org/show_bug.cgi?id=200225
+
+        Reviewed by Brent Fulgham.
+
+        The code was WTFMove()-ing the method parameter inside of a loop, which means that it could
+        move it several times. Instead of copying the parameters, I opted into sending the statistics
+        only to the network session that matches this WebProcess connection.
+
+        * NetworkProcess/NetworkConnectionToWebProcess.cpp:
+        (WebKit::NetworkConnectionToWebProcess::resourceLoadStatisticsUpdated):
+
 2019-07-27  Chris Dumez  <[email protected]>
 
         Allow more syscalls in the WebContent process' sandbox profile

Modified: trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp (247904 => 247905)


--- trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp	2019-07-29 14:40:16 UTC (rev 247904)
+++ trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp	2019-07-29 16:42:23 UTC (rev 247905)
@@ -696,13 +696,12 @@
 
 void NetworkConnectionToWebProcess::resourceLoadStatisticsUpdated(Vector<WebCore::ResourceLoadStatistics>&& statistics)
 {
-    for (auto& networkSession : networkProcess().networkSessions().values()) {
-        if (networkSession->sessionID().isEphemeral())
-            continue;
+    auto* networkSession = networkProcess().networkSessionByConnection(connection());
+    if (!networkSession)
+        return;
 
-        if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
-            resourceLoadStatistics->resourceLoadStatisticsUpdated(WTFMove(statistics));
-    }
+    if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
+        resourceLoadStatistics->resourceLoadStatisticsUpdated(WTFMove(statistics));
 }
 
 void NetworkConnectionToWebProcess::hasStorageAccess(PAL::SessionID sessionID, const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, uint64_t frameID, PageIdentifier pageID, CompletionHandler<void(bool)>&& completionHandler)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to