[cairo-commit] 3 commits - src/cairo.c src/cairo-debug.c src/cairo-device.c src/cairo-error-private.h src/cairo-ft-font.c src/cairo.h src/cairo-misc.c src/cairo-region.c src/cairo-spans.c src/cairo-surface.c src/cairo-svg-glyph-render.c util/cairo-trace

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Jan 21 08:39:31 UTC 2023


 src/cairo-debug.c            |    1 +
 src/cairo-device.c           |    1 +
 src/cairo-error-private.h    |    1 +
 src/cairo-ft-font.c          |    3 ---
 src/cairo-misc.c             |    2 ++
 src/cairo-region.c           |    1 +
 src/cairo-spans.c            |    2 ++
 src/cairo-surface.c          |    1 +
 src/cairo-svg-glyph-render.c |    4 ++--
 src/cairo.c                  |    3 ++-
 src/cairo.h                  |    1 +
 util/cairo-trace/trace.c     |    1 +
 12 files changed, 15 insertions(+), 6 deletions(-)

New commits:
commit ea51a5d66aaae74cdb436d5de4c429e1f1609aba
Merge: 7072f6261 ae256003f
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Sat Jan 21 08:39:29 2023 +0000

    Merge branch 'fix-svg-crash' into 'master'
    
    Fix svg renderer crash
    
    See merge request cairo/cairo!416

commit ae256003fb09c84d0af696f09f9d4ad07a8864e7
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Fri Jan 20 20:39:29 2023 +1030

    svg-font: fix parse bug on empty tags

diff --git a/src/cairo-svg-glyph-render.c b/src/cairo-svg-glyph-render.c
index 176c08484..2ca0d4cea 100644
--- a/src/cairo-svg-glyph-render.c
+++ b/src/cairo-svg-glyph-render.c
@@ -1269,7 +1269,7 @@ parse_svg (cairo_svg_glyph_render_t *svg_render,
         /* We should now be in a start or empty element tag */
 
         /* find end of tag name */
-        end = strpbrk(p, WHITE_SPACE_CHARS ">");
+        end = strpbrk(p, WHITE_SPACE_CHARS "/>");
         if (!end) {
             parse_error (svg_render, svg_document, p, "Could not find '>'");
             goto fail;
commit cbcf962da267c519c73dce3cb25afc8c983e1f5b
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Fri Jan 20 20:37:45 2023 +1030

    svg-font: return SVG_FONT_ERROR on error

diff --git a/src/cairo-debug.c b/src/cairo-debug.c
index c83df3f47..11777f04b 100644
--- a/src/cairo-debug.c
+++ b/src/cairo-debug.c
@@ -405,6 +405,7 @@ _cairo_debug_status_to_string (cairo_int_status_t status)
 	case CAIRO_INT_STATUS_WIN32_GDI_ERROR: return "WIN32_GDI_ERROR";
 	case CAIRO_INT_STATUS_TAG_ERROR: return "TAG_ERROR";
 	case CAIRO_INT_STATUS_DWRITE_ERROR: return "DWRITE_ERROR";
+	case CAIRO_INT_STATUS_SVG_FONT_ERROR: return "SVG_FONT_ERROR";
 
 	case CAIRO_INT_STATUS_LAST_STATUS: return "LAST_STATUS";
 
diff --git a/src/cairo-device.c b/src/cairo-device.c
index 50e7ee484..57b63a778 100644
--- a/src/cairo-device.c
+++ b/src/cairo-device.c
@@ -164,6 +164,7 @@ _cairo_device_create_in_error (cairo_status_t status)
     case CAIRO_STATUS_WIN32_GDI_ERROR:
     case CAIRO_STATUS_TAG_ERROR:
     case CAIRO_STATUS_DWRITE_ERROR:
+    case CAIRO_STATUS_SVG_FONT_ERROR:
     default:
 	_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
 	return (cairo_device_t *) &_nil_device;
diff --git a/src/cairo-error-private.h b/src/cairo-error-private.h
index d84d4c23d..ba95db767 100644
--- a/src/cairo-error-private.h
+++ b/src/cairo-error-private.h
@@ -99,6 +99,7 @@ enum _cairo_int_status {
     CAIRO_INT_STATUS_WIN32_GDI_ERROR,
     CAIRO_INT_STATUS_TAG_ERROR,
     CAIRO_INT_STATUS_DWRITE_ERROR,
+    CAIRO_INT_STATUS_SVG_FONT_ERROR,
 
     CAIRO_INT_STATUS_LAST_STATUS,
 
diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c
index 6ff142f76..998878228 100644
--- a/src/cairo-ft-font.c
+++ b/src/cairo-ft-font.c
@@ -2982,9 +2982,6 @@ _cairo_ft_scaled_glyph_init_record_svg_glyph (cairo_ft_scaled_font_t *scaled_fon
 					  palette,
 					  num_palette_entries,
 					  cr);
-	if (status == CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED)
-	    status = CAIRO_INT_STATUS_UNSUPPORTED;
-
 	if (status == CAIRO_STATUS_SUCCESS)
 	    status = cairo_status (cr);
     }
diff --git a/src/cairo-misc.c b/src/cairo-misc.c
index 7ac0e8d05..6f6f9937e 100644
--- a/src/cairo-misc.c
+++ b/src/cairo-misc.c
@@ -176,6 +176,8 @@ cairo_status_to_string (cairo_status_t status)
 	return "invalid tag name, attributes, or nesting";
     case CAIRO_STATUS_DWRITE_ERROR:
 	return "Window Direct Write error";
+    case CAIRO_STATUS_SVG_FONT_ERROR:
+	return "error occured while rendering an OpenType-SVG font";
     default:
     case CAIRO_STATUS_LAST_STATUS:
 	return "<unknown error status>";
diff --git a/src/cairo-region.c b/src/cairo-region.c
index eb78cf4a8..d38f50d92 100644
--- a/src/cairo-region.c
+++ b/src/cairo-region.c
@@ -112,6 +112,7 @@ _cairo_region_create_in_error (cairo_status_t status)
     case CAIRO_STATUS_WIN32_GDI_ERROR:
     case CAIRO_STATUS_TAG_ERROR:
     case CAIRO_STATUS_DWRITE_ERROR:
+    case CAIRO_STATUS_SVG_FONT_ERROR:
     default:
 	_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
 	return (cairo_region_t *) &_cairo_region_nil;
diff --git a/src/cairo-spans.c b/src/cairo-spans.c
index 1b46adf4d..711c0c106 100644
--- a/src/cairo-spans.c
+++ b/src/cairo-spans.c
@@ -133,6 +133,7 @@ _cairo_scan_converter_create_in_error (cairo_status_t status)
     case CAIRO_STATUS_WIN32_GDI_ERROR:
     case CAIRO_STATUS_TAG_ERROR:
     case CAIRO_STATUS_DWRITE_ERROR:
+    case CAIRO_STATUS_SVG_FONT_ERROR:
     default:
 	break;
     }
@@ -251,6 +252,7 @@ _cairo_span_renderer_create_in_error (cairo_status_t status)
     case CAIRO_STATUS_WIN32_GDI_ERROR: RETURN_NIL;
     case CAIRO_STATUS_TAG_ERROR: RETURN_NIL;
     case CAIRO_STATUS_DWRITE_ERROR: RETURN_NIL;
+    case CAIRO_STATUS_SVG_FONT_ERROR: RETURN_NIL;
     default:
 	break;
     }
diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index fd661221b..a9bd3b579 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -3151,6 +3151,7 @@ _cairo_surface_create_in_error (cairo_status_t status)
     case CAIRO_STATUS_WIN32_GDI_ERROR:
     case CAIRO_INT_STATUS_DWRITE_ERROR:
     case CAIRO_STATUS_TAG_ERROR:
+    case CAIRO_STATUS_SVG_FONT_ERROR:
     default:
 	_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
 	return (cairo_surface_t *) &_cairo_surface_nil;
diff --git a/src/cairo-svg-glyph-render.c b/src/cairo-svg-glyph-render.c
index 96094cbd2..176c08484 100644
--- a/src/cairo-svg-glyph-render.c
+++ b/src/cairo-svg-glyph-render.c
@@ -3141,7 +3141,7 @@ _cairo_render_svg_glyph (const char           *svg_document,
     /* First parse elements into a tree and populate ids hash table */
     if (!parse_svg (svg_render, svg_document)) {
         print_error (svg_render, "Parse SVG document failed");
-        status = CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED;
+        status = CAIRO_STATUS_SVG_FONT_ERROR;
         goto cleanup;
     }
 
diff --git a/src/cairo.c b/src/cairo.c
index 35696ab89..55e7103ea 100644
--- a/src/cairo.c
+++ b/src/cairo.c
@@ -372,7 +372,8 @@ static const cairo_t _cairo_nil[] = {
     DEFINE_NIL_CONTEXT (CAIRO_STATUS_FREETYPE_ERROR),
     DEFINE_NIL_CONTEXT (CAIRO_STATUS_WIN32_GDI_ERROR),
     DEFINE_NIL_CONTEXT (CAIRO_STATUS_TAG_ERROR),
-    DEFINE_NIL_CONTEXT (CAIRO_STATUS_DWRITE_ERROR)
+    DEFINE_NIL_CONTEXT (CAIRO_STATUS_DWRITE_ERROR),
+    DEFINE_NIL_CONTEXT (CAIRO_STATUS_SVG_FONT_ERROR)
 };
 COMPILE_TIME_ASSERT (ARRAY_LENGTH (_cairo_nil) == CAIRO_STATUS_LAST_STATUS - 1);
 
diff --git a/src/cairo.h b/src/cairo.h
index 82e2c69d8..d19c32418 100644
--- a/src/cairo.h
+++ b/src/cairo.h
@@ -358,6 +358,7 @@ typedef enum _cairo_status {
     CAIRO_STATUS_WIN32_GDI_ERROR,
     CAIRO_STATUS_TAG_ERROR,
     CAIRO_STATUS_DWRITE_ERROR,
+    CAIRO_STATUS_SVG_FONT_ERROR,
 
     CAIRO_STATUS_LAST_STATUS
 } cairo_status_t;
diff --git a/util/cairo-trace/trace.c b/util/cairo-trace/trace.c
index 61e57f4d8..a9181ce24 100644
--- a/util/cairo-trace/trace.c
+++ b/util/cairo-trace/trace.c
@@ -1600,6 +1600,7 @@ _status_to_string (cairo_status_t status)
 	f(WIN32_GDI_ERROR);
 	f(TAG_ERROR);
 	f(DWRITE_ERROR);
+	f(SVG_FONT_ERROR);
     case CAIRO_STATUS_LAST_STATUS:
 	break;
     }


More information about the cairo-commit mailing list