Title: [274640] trunk/Source/WebCore
- Revision
- 274640
- Author
- carlo...@webkit.org
- Date
- 2021-03-18 04:12:35 -0700 (Thu, 18 Mar 2021)
Log Message
[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: trunk/Source/WebCore/ChangeLog (274639 => 274640)
--- trunk/Source/WebCore/ChangeLog 2021-03-18 11:09:22 UTC (rev 274639)
+++ trunk/Source/WebCore/ChangeLog 2021-03-18 11:12:35 UTC (rev 274640)
@@ -1,3 +1,19 @@
+2021-03-18 Carlos Garcia Campos <cgar...@igalia.com>
+
+ [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-18 Lauro Moura <lmo...@igalia.com>
[Nicosia] Backport cocoa fix for RTL sticky position from r273982
Modified: trunk/Source/WebCore/platform/network/soup/WebKitFormDataInputStream.cpp (274639 => 274640)
--- trunk/Source/WebCore/platform/network/soup/WebKitFormDataInputStream.cpp 2021-03-18 11:09:22 UTC (rev 274639)
+++ trunk/Source/WebCore/platform/network/soup/WebKitFormDataInputStream.cpp 2021-03-18 11:12:35 UTC (rev 274640)
@@ -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
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes