Title: [275043] releases/WebKitGTK/webkit-2.32/Source/WebCore
- Revision
- 275043
- Author
- [email protected]
- Date
- 2021-03-25 10:06:34 -0700 (Thu, 25 Mar 2021)
Log Message
Merge r274640 - [SOUP] SOUP3 crashes inside soup_message_set_request_body
https://bugs.webkit.org/show_bug.cgi?id=223236
Reviewed by Adrian Perez de Castro.
Make WebKitFormDataInputStream implement GPollableInputStream.
* platform/network/soup/WebKitFormDataInputStream.cpp:
(webkitFormDataInputStreamNew):
(webkitFormDataInputStreamCanPoll):
(webkitFormDataInputStreamIsReadable):
(webkitFormDataInputStreamCreateSource):
(webkitFormDataInputStreamPollableInterfaceInit):
Modified Paths
Diff
Modified: releases/WebKitGTK/webkit-2.32/Source/WebCore/ChangeLog (275042 => 275043)
--- releases/WebKitGTK/webkit-2.32/Source/WebCore/ChangeLog 2021-03-25 17:06:29 UTC (rev 275042)
+++ releases/WebKitGTK/webkit-2.32/Source/WebCore/ChangeLog 2021-03-25 17:06:34 UTC (rev 275043)
@@ -1,3 +1,19 @@
+2021-03-18 Carlos Garcia Campos <[email protected]>
+
+ [SOUP] SOUP3 crashes inside soup_message_set_request_body
+ https://bugs.webkit.org/show_bug.cgi?id=223236
+
+ Reviewed by Adrian Perez de Castro.
+
+ Make WebKitFormDataInputStream implement GPollableInputStream.
+
+ * platform/network/soup/WebKitFormDataInputStream.cpp:
+ (webkitFormDataInputStreamNew):
+ (webkitFormDataInputStreamCanPoll):
+ (webkitFormDataInputStreamIsReadable):
+ (webkitFormDataInputStreamCreateSource):
+ (webkitFormDataInputStreamPollableInterfaceInit):
+
2021-03-16 Carlos Garcia Campos <[email protected]>
[GTK][WPE] Stop using g_memdup
Modified: releases/WebKitGTK/webkit-2.32/Source/WebCore/platform/network/soup/WebKitFormDataInputStream.cpp (275042 => 275043)
--- releases/WebKitGTK/webkit-2.32/Source/WebCore/platform/network/soup/WebKitFormDataInputStream.cpp 2021-03-25 17:06:29 UTC (rev 275042)
+++ releases/WebKitGTK/webkit-2.32/Source/WebCore/platform/network/soup/WebKitFormDataInputStream.cpp 2021-03-25 17:06:34 UTC (rev 275043)
@@ -37,10 +37,14 @@
GRefPtr<GInputStream> currentStream;
unsigned nextIndex;
long long currentStreamRangeLength;
+ bool canPoll;
};
-WEBKIT_DEFINE_TYPE(WebKitFormDataInputStream, webkit_form_data_input_stream, G_TYPE_INPUT_STREAM)
+static void webkitFormDataInputStreamPollableInterfaceInit(GPollableInputStreamInterface*);
+WEBKIT_DEFINE_TYPE_WITH_CODE(WebKitFormDataInputStream, webkit_form_data_input_stream, G_TYPE_INPUT_STREAM,
+ G_IMPLEMENT_INTERFACE(G_TYPE_POLLABLE_INPUT_STREAM, webkitFormDataInputStreamPollableInterfaceInit))
+
static bool webkitFormDataInputStreamCreateNextStream(WebKitFormDataInputStream* stream, GCancellable* cancellable)
{
auto* priv = stream->priv;
@@ -130,6 +134,15 @@
stream->priv->formData = WTFMove(formData);
stream->priv->currentStreamRangeLength = BlobDataItem::toEndOfFile;
+ // GFileInputStream is not pollable, so the stream is only pollable if FormData doesn't contain EncodedFileData elements.
+ stream->priv->canPoll = true;
+ for (const auto& element : stream->priv->formData->elements()) {
+ if (WTF::holds_alternative<FormDataElement::EncodedFileData>(element.data)) {
+ stream->priv->canPoll = false;
+ break;
+ }
+ }
+
return adoptGRef(G_INPUT_STREAM((stream)));
}
@@ -145,3 +158,28 @@
return g_memory_output_stream_steal_as_bytes(G_MEMORY_OUTPUT_STREAM(outputStream.get()));
}
+
+static gboolean webkitFormDataInputStreamCanPoll(GPollableInputStream* stream)
+{
+ auto* priv = WEBKIT_FORM_DATA_INPUT_STREAM(stream)->priv;
+ return priv->canPoll;
+}
+
+static gboolean webkitFormDataInputStreamIsReadable(GPollableInputStream* stream)
+{
+ auto* priv = WEBKIT_FORM_DATA_INPUT_STREAM(stream)->priv;
+ return priv->currentStream || priv->nextIndex < priv->formData->elements().size();
+}
+
+static GSource* webkitFormDataInputStreamCreateSource(GPollableInputStream* stream, GCancellable* cancellable)
+{
+ GRefPtr<GSource> base = adoptGRef(g_timeout_source_new(0));
+ return g_pollable_source_new_full(stream, base.get(), cancellable);
+}
+
+static void webkitFormDataInputStreamPollableInterfaceInit(GPollableInputStreamInterface* iface)
+{
+ iface->can_poll = webkitFormDataInputStreamCanPoll;
+ iface->is_readable = webkitFormDataInputStreamIsReadable;
+ iface->create_source = webkitFormDataInputStreamCreateSource;
+}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes