From 3bb1c962ebd6e6edc0af80706922e984983733b9 Mon Sep 17 00:00:00 2001 From: Moonchild Date: Sat, 20 Nov 2021 23:05:25 +0000 Subject: [PATCH] Issue #3039 - Don't try to pass a dash array of > 16 elements to ExtCreatePen. According to MSDN documentation, the count of the style array passed to ExtCreatePen is limited to 16. When we call ExtCreatePen with cStyle=17 or more, it simply returns an error and the cairo surface used for printing is getting into an error state, after which nothing further gets printed. Instead of erroring out, this code change returns an unsupported status so that cairo will provide fallback handling for it. --- gfx/cairo/cairo/src/cairo-win32-printing-surface.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gfx/cairo/cairo/src/cairo-win32-printing-surface.c b/gfx/cairo/cairo/src/cairo-win32-printing-surface.c index 23db876940..89b6e1b810 100644 --- a/gfx/cairo/cairo/src/cairo-win32-printing-surface.c +++ b/gfx/cairo/cairo/src/cairo-win32-printing-surface.c @@ -1265,6 +1265,9 @@ _cairo_win32_printing_surface_stroke (void *abstract_surface, } if (surface->paginated_mode == CAIRO_PAGINATED_MODE_ANALYZE) { + /* Win32 does not support more than 16 elements in the dash array. */ + if (style->num_dashes > 16) + return CAIRO_INT_STATUS_UNSUPPORTED; /* Win32 does not support a dash offset. */ if (style->num_dashes > 0 && style->dash_offset != 0.0) return CAIRO_INT_STATUS_UNSUPPORTED;