| Summary: | [GTK] gdk_memory_texture_new: assertion 'width > 0' failed in cairoSurfaceToGdkTexture | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Michael Catanzaro <mcatanzaro> |
| Component: | WebKitGTK | Assignee: | Michael Catanzaro <mcatanzaro> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | bugs-noreply, mcatanzaro |
| Priority: | P2 | ||
| Version: | WebKit Nightly Build | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| See Also: | https://bugs.webkit.org/show_bug.cgi?id=258918 | ||
|
Description
Michael Catanzaro
2023-02-16 15:02:35 PST
So an initial fix is:
diff --git a/Source/WebCore/platform/graphics/gtk/GdkCairoUtilities.cpp b/Source/WebCore/platform/graphics/gtk/GdkCairoUtilities.cpp
index 299bea86401d..43c20263e429 100644
--- a/Source/WebCore/platform/graphics/gtk/GdkCairoUtilities.cpp
+++ b/Source/WebCore/platform/graphics/gtk/GdkCairoUtilities.cpp
@@ -48,6 +48,8 @@ GRefPtr<GdkTexture> cairoSurfaceToGdkTexture(cairo_surface_t* surface)
ASSERT(cairo_image_surface_get_format(surface) == CAIRO_FORMAT_ARGB32);
auto width = cairo_image_surface_get_width(surface);
auto height = cairo_image_surface_get_height(surface);
+ if (width <= 0 || height <= 0)
+ return nullptr;
auto stride = cairo_image_surface_get_stride(surface);
auto* data = cairo_image_surface_get_data(surface);
GRefPtr<GBytes> bytes = adoptGRef(g_bytes_new_with_free_func(data, height * stride, [](gpointer data) {
But then Epiphany crashes later on in ephy_snapshot_service_prepare_snapshot() in basically the same way, and it doesn't look like Epiphany, fault. Problem is webkit_web_view_get_snapshot_finish() can return nullptr without setting the error parameter. I think we should set WEBKIT_SNAPSHOT_ERROR_FAILED_TO_CREATE error when returning nullptr, does that sound OK?
Pull request: https://github.com/WebKit/WebKit/pull/10310 Committed 273907@main (39559cbd2d25): <https://commits.webkit.org/273907@main> Reviewed commits have been landed. Closing PR #10310 and removing active labels. |