Title: [247874] trunk/Source/WebCore
- Revision
- 247874
- Author
- [email protected]
- Date
- 2019-07-26 13:46:48 -0700 (Fri, 26 Jul 2019)
Log Message
[curl] Heap corruption in ~CurlResponse
https://bugs.webkit.org/show_bug.cgi?id=198320
Patch by Takashi Komori <[email protected]> on 2019-07-26
Reviewed by Fujii Hironori.
Stop sharing object which was reffered by two threads to fix crash bug.
No tests needed, no functionality changes.
* platform/network/curl/CurlRequest.cpp:
(WebCore::CurlRequest::start):
(WebCore::CurlRequest::invokeDidReceiveResponseForFile):
* platform/network/curl/CurlRequest.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (247873 => 247874)
--- trunk/Source/WebCore/ChangeLog 2019-07-26 20:34:28 UTC (rev 247873)
+++ trunk/Source/WebCore/ChangeLog 2019-07-26 20:46:48 UTC (rev 247874)
@@ -1,3 +1,19 @@
+2019-07-26 Takashi Komori <[email protected]>
+
+ [curl] Heap corruption in ~CurlResponse
+ https://bugs.webkit.org/show_bug.cgi?id=198320
+
+ Reviewed by Fujii Hironori.
+
+ Stop sharing object which was reffered by two threads to fix crash bug.
+
+ No tests needed, no functionality changes.
+
+ * platform/network/curl/CurlRequest.cpp:
+ (WebCore::CurlRequest::start):
+ (WebCore::CurlRequest::invokeDidReceiveResponseForFile):
+ * platform/network/curl/CurlRequest.h:
+
2019-07-26 Youenn Fablet <[email protected]>
slides.google.com: opening speaker notes while presenting causes a fatal error in the web app on iPad
Modified: trunk/Source/WebCore/platform/network/curl/CurlRequest.cpp (247873 => 247874)
--- trunk/Source/WebCore/platform/network/curl/CurlRequest.cpp 2019-07-26 20:34:28 UTC (rev 247873)
+++ trunk/Source/WebCore/platform/network/curl/CurlRequest.cpp 2019-07-26 20:46:48 UTC (rev 247874)
@@ -35,6 +35,7 @@
#include "NetworkLoadMetrics.h"
#include "ResourceError.h"
#include "SharedBuffer.h"
+#include <wtf/CrossThreadCopier.h>
#include <wtf/Language.h>
#include <wtf/MainThread.h>
@@ -106,13 +107,11 @@
ASSERT(isMainThread());
- auto url = ""
-
if (std::isnan(m_requestStartTime))
m_requestStartTime = MonotonicTime::now().isolatedCopy();
- if (url.isLocalFile())
- invokeDidReceiveResponseForFile(url);
+ if (m_request.url().isLocalFile())
+ invokeDidReceiveResponseForFile(m_request.url());
else
startWithJobManager();
}
@@ -579,7 +578,7 @@
m_curlHandle->setReadCallbackFunction(willSendDataCallback, this);
}
-void CurlRequest::invokeDidReceiveResponseForFile(URL& url)
+void CurlRequest::invokeDidReceiveResponseForFile(const URL& url)
{
// Since the code in didReceiveHeader() will not have run for local files
// the code to set the URL and fire didReceiveResponse is never run,
@@ -589,15 +588,17 @@
ASSERT(isMainThread());
ASSERT(url.isLocalFile());
- m_response.url = ""
- m_response.statusCode = 200;
-
// Determine the MIME type based on the path.
- m_response.headers.append(String("Content-Type: " + MIMETypeRegistry::getMIMETypeForPath(m_response.url.path())));
+ auto mimeType = MIMETypeRegistry::getMIMETypeForPath(url.path());
// DidReceiveResponse must not be called immediately
- runOnWorkerThreadIfRequired([this, protectedThis = makeRef(*this)]() {
- invokeDidReceiveResponse(m_response, Action::StartTransfer);
+ runOnWorkerThreadIfRequired([this, protectedThis = makeRef(*this), url = "" mimeType = crossThreadCopy(WTFMove(mimeType))]() mutable {
+ CurlResponse response;
+ response.url = ""
+ response.statusCode = 200;
+ response.headers.append("Content-Type: " + mimeType);
+
+ invokeDidReceiveResponse(response, Action::StartTransfer);
});
}
Modified: trunk/Source/WebCore/platform/network/curl/CurlRequest.h (247873 => 247874)
--- trunk/Source/WebCore/platform/network/curl/CurlRequest.h 2019-07-26 20:34:28 UTC (rev 247873)
+++ trunk/Source/WebCore/platform/network/curl/CurlRequest.h 2019-07-26 20:46:48 UTC (rev 247874)
@@ -141,7 +141,7 @@
// Processing for DidReceiveResponse
bool needToInvokeDidReceiveResponse() const { return m_didReceiveResponse && !m_didNotifyResponse; }
bool needToInvokeDidCancelTransfer() const { return m_didNotifyResponse && !m_didReturnFromNotify && m_actionAfterInvoke == Action::FinishTransfer; }
- void invokeDidReceiveResponseForFile(URL&);
+ void invokeDidReceiveResponseForFile(const URL&);
void invokeDidReceiveResponse(const CurlResponse&, Action);
void setRequestPaused(bool);
void setCallbackPaused(bool);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes