[librsvg/librsvg-2.40: 7/10] Add tests for recursive element references and billion-laughs through references



commit a9805d9176392eedd38900413d69960bee786562
Author: Federico Mena Quintero <federico gnome org>
Date:   Wed Feb 26 11:29:03 2020 -0600

    Add tests for recursive element references and billion-laughs through references

 tests/Makefile.am                                  |   9 +-
 tests/errors.c                                     | 102 +++++++++++
 tests/fixtures/errors/308-doubly-recursive-use.svg |  13 ++
 tests/fixtures/errors/308-recursive-use.svg        |   9 +
 tests/fixtures/errors/308-use-self-ref.svg         |   7 +
 tests/fixtures/errors/323-nested-use.svg           | 196 +++++++++++++++++++++
 .../fixtures/errors/515-pattern-billion-laughs.svg | 130 ++++++++++++++
 tests/fixtures/errors/515-too-many-elements.svgz   | Bin 0 -> 40811 bytes
 8 files changed, 465 insertions(+), 1 deletion(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 1c11db54..175e8f3e 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,12 +1,14 @@
 include $(top_srcdir)/glib-tap.mk
 
+# Keep "errors" at the end; they are the slowest to run
 test_programs =                \
        loading         \
        rsvg-test       \
        crash           \
        styles          \
        render-crash    \
-       dimensions
+       dimensions      \
+       errors
 
 test_utils_common_sources = \
        test-utils.c    \
@@ -16,6 +18,10 @@ rsvg_test_SOURCES = \
        rsvg-test.c     \
        $(test_utils_common_sources)
 
+errors_SOURCES =       \
+       errors.c        \
+       $(test_utils_common_sources)
+
 crash_SOURCES = \
        crash.c         \
        $(test_utils_common_sources)
@@ -51,6 +57,7 @@ dist_installed_test_data =                                            \
        $(wildcard $(srcdir)/resources/*)                               \
        $(wildcard $(srcdir)/fixtures/crash/*.svg)                      \
        $(wildcard $(srcdir)/fixtures/crash/*.png)                      \
+       $(wildcard $(srcdir)/fixtures/errors/*)                         \
        $(wildcard $(srcdir)/fixtures/loading/*)                        \
        $(wildcard $(srcdir)/fixtures/reftests/*.svg)                   \
        $(wildcard $(srcdir)/fixtures/reftests/*.png)                   \
diff --git a/tests/errors.c b/tests/errors.c
new file mode 100644
index 00000000..475dd12c
--- /dev/null
+++ b/tests/errors.c
@@ -0,0 +1,102 @@
+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* vim: set ts=4 nowrap ai expandtab sw=4: */
+
+#include "config.h"
+
+#include <stdio.h>
+#include <glib.h>
+
+#include "rsvg.h"
+#include "test-utils.h"
+
+/* These tests are meant to test the error handlers in librsvg.  As of 2.44.x we
+ * don't have a public API that can actually report detailed errors; we just
+ * report a boolean success value from the rendering functions.  In time, we can
+ * add a richer API and test for specific errors here.
+ */
+
+static char *
+get_test_filename (const char *basename) {
+    return g_build_filename (test_utils_get_test_data_path (),
+                             "errors",
+                             basename,
+                             NULL);
+}
+
+static void
+test_loading_error (gconstpointer data)
+{
+    const char *basename = data;
+    char *filename = get_test_filename (basename);
+    RsvgHandle *handle;
+    GError *error = NULL;
+
+    handle = rsvg_handle_new_from_file (filename, &error);
+    g_free (filename);
+
+    g_assert (handle == NULL);
+    g_assert (g_error_matches (error, RSVG_ERROR, RSVG_ERROR_FAILED));
+
+    g_error_free (error);
+}
+
+static void
+test_instancing_limit (gconstpointer data)
+{
+    const char *basename = data;
+    char *filename = get_test_filename (basename);
+    RsvgHandle *handle;
+    GError *error = NULL;
+    cairo_surface_t *surf;
+    cairo_t *cr;
+
+    handle = rsvg_handle_new_from_file (filename, &error);
+    g_free (filename);
+    g_assert (handle != NULL);
+    g_assert (error == NULL);
+
+    surf = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 1, 11);
+    cr = cairo_create (surf);
+
+    g_assert (!rsvg_handle_render_cairo (handle, cr));
+
+    g_object_unref (handle);
+}
+
+int
+main (int argc, char **argv)
+{
+    g_test_init (&argc, &argv, NULL);
+
+    g_test_add_data_func_full ("/errors/instancing_limit/323-nested-use.svg",
+                               "323-nested-use.svg",
+                               test_instancing_limit,
+                               NULL);
+
+    g_test_add_data_func_full ("/errors/instancing_limit/515-pattern-billion-laughs.svg",
+                               "515-pattern-billion-laughs.svg",
+                               test_instancing_limit,
+                               NULL);
+
+    g_test_add_data_func_full ("/errors/instancing_limit/308-use-self-ref.svg",
+                               "308-use-self-ref.svg",
+                               test_instancing_limit,
+                               NULL);
+    g_test_add_data_func_full ("/errors/instancing_limit/308-recursive-use.svg",
+                               "308-recursive-use.svg",
+                               test_instancing_limit,
+                               NULL);
+    g_test_add_data_func_full ("/errors/instancing_limit/308-doubly-recursive-use.svg",
+                               "308-doubly-recursive-use.svg",
+                               test_instancing_limit,
+                               NULL);
+/*
+    g_test_add_data_func_full ("/errors/515-too-many-elements.svgz",
+                               "515-too-many-elements.svgz",
+                               test_loading_error,
+                               NULL);
+*/
+
+
+    return g_test_run ();
+}
diff --git a/tests/fixtures/errors/308-doubly-recursive-use.svg 
b/tests/fixtures/errors/308-doubly-recursive-use.svg
new file mode 100644
index 00000000..9b248a6f
--- /dev/null
+++ b/tests/fixtures/errors/308-doubly-recursive-use.svg
@@ -0,0 +1,13 @@
+<svg>
+  <defs>
+    <g id="one">
+      <use xlink:href="#two"/>
+    </g>
+
+    <g id="two">
+      <use xlink:href="#one"/>
+    </g>
+  </defs>
+
+  <use xlink:href="#one"/>
+</svg>
diff --git a/tests/fixtures/errors/308-recursive-use.svg b/tests/fixtures/errors/308-recursive-use.svg
new file mode 100644
index 00000000..f5d00bf2
--- /dev/null
+++ b/tests/fixtures/errors/308-recursive-use.svg
@@ -0,0 +1,9 @@
+<svg>
+  <defs>
+    <g id="one">
+      <use xlink:href="#one"/>
+    </g>
+  </defs>
+
+  <use xlink:href="#one"/>
+</svg>
diff --git a/tests/fixtures/errors/308-use-self-ref.svg b/tests/fixtures/errors/308-use-self-ref.svg
new file mode 100644
index 00000000..dbf14c54
--- /dev/null
+++ b/tests/fixtures/errors/308-use-self-ref.svg
@@ -0,0 +1,7 @@
+<svg>
+  <defs>
+    <use id="one" xlink:href="#one"/>
+  </defs>
+
+  <use xlink:href="#one"/>
+</svg>
diff --git a/tests/fixtures/errors/323-nested-use.svg b/tests/fixtures/errors/323-nested-use.svg
new file mode 100644
index 00000000..075b48eb
--- /dev/null
+++ b/tests/fixtures/errors/323-nested-use.svg
@@ -0,0 +1,196 @@
+<?xml version="1.0" ?>
+<svg height="600" width="600" xmlns="http://www.w3.org/2000/svg"; 
xmlns:ev="http://www.w3.org/2001/xml-events"; xmlns:xlink="http://www.w3.org/1999/xlink";>
+  <defs >
+    <g id="l0">
+      <rect width="600" height="600" fill="black"/>
+    </g>
+    <g id="l1">
+      <use xlink:href="#l0" transform="translate(0,0) scale(0.3333333333333333)"/>
+      <use xlink:href="#l0" transform="translate(200,0) scale(0.3333333333333333)"/>
+      <use xlink:href="#l0" transform="translate(0,200) scale(0.3333333333333333)"/>
+      <use xlink:href="#l0" transform="translate(200,200) scale(0.3333333333333333)"/>
+      <use xlink:href="#l0" transform="translate(400,200) scale(0.3333333333333333)"/>
+      <use xlink:href="#l0" transform="translate(0,400) scale(0.3333333333333333)"/>
+      <use xlink:href="#l0" transform="translate(200,400) scale(0.3333333333333333)"/>
+      <use xlink:href="#l0" transform="translate(400,400) scale(0.3333333333333333)"/>
+      <use xlink:href="#l0" transform="translate(500,0) rotate(45) scale(0.233)"/>
+    </g>
+    <g id="l2">
+      <use xlink:href="#l1" transform="translate(0,0) scale(0.3333333333333333)"/>
+      <use xlink:href="#l1" transform="translate(200,0) scale(0.3333333333333333)"/>
+      <use xlink:href="#l1" transform="translate(0,200) scale(0.3333333333333333)"/>
+      <use xlink:href="#l1" transform="translate(200,200) scale(0.3333333333333333)"/>
+      <use xlink:href="#l1" transform="translate(400,200) scale(0.3333333333333333)"/>
+      <use xlink:href="#l1" transform="translate(0,400) scale(0.3333333333333333)"/>
+      <use xlink:href="#l1" transform="translate(200,400) scale(0.3333333333333333)"/>
+      <use xlink:href="#l1" transform="translate(400,400) scale(0.3333333333333333)"/>
+      <use xlink:href="#l1" transform="translate(500,0) rotate(45) scale(0.233)"/>
+    </g>
+    <g id="l3">
+      <use xlink:href="#l2" transform="translate(0,0) scale(0.3333333333333333)"/>
+      <use xlink:href="#l2" transform="translate(200,0) scale(0.3333333333333333)"/>
+      <use xlink:href="#l2" transform="translate(0,200) scale(0.3333333333333333)"/>
+      <use xlink:href="#l2" transform="translate(200,200) scale(0.3333333333333333)"/>
+      <use xlink:href="#l2" transform="translate(400,200) scale(0.3333333333333333)"/>
+      <use xlink:href="#l2" transform="translate(0,400) scale(0.3333333333333333)"/>
+      <use xlink:href="#l2" transform="translate(200,400) scale(0.3333333333333333)"/>
+      <use xlink:href="#l2" transform="translate(400,400) scale(0.3333333333333333)"/>
+      <use xlink:href="#l2" transform="translate(500,0) rotate(45) scale(0.233)"/>
+    </g>
+    <g id="l4">
+      <use xlink:href="#l3" transform="translate(0,0) scale(0.3333333333333333)"/>
+      <use xlink:href="#l3" transform="translate(200,0) scale(0.3333333333333333)"/>
+      <use xlink:href="#l3" transform="translate(0,200) scale(0.3333333333333333)"/>
+      <use xlink:href="#l3" transform="translate(200,200) scale(0.3333333333333333)"/>
+      <use xlink:href="#l3" transform="translate(400,200) scale(0.3333333333333333)"/>
+      <use xlink:href="#l3" transform="translate(0,400) scale(0.3333333333333333)"/>
+      <use xlink:href="#l3" transform="translate(200,400) scale(0.3333333333333333)"/>
+      <use xlink:href="#l3" transform="translate(400,400) scale(0.3333333333333333)"/>
+      <use xlink:href="#l3" transform="translate(500,0) rotate(45) scale(0.233)"/>
+    </g>
+    <g id="l5">
+      <use xlink:href="#l4" transform="translate(0,0) scale(0.3333333333333333)"/>
+      <use xlink:href="#l4" transform="translate(200,0) scale(0.3333333333333333)"/>
+      <use xlink:href="#l4" transform="translate(0,200) scale(0.3333333333333333)"/>
+      <use xlink:href="#l4" transform="translate(200,200) scale(0.3333333333333333)"/>
+      <use xlink:href="#l4" transform="translate(400,200) scale(0.3333333333333333)"/>
+      <use xlink:href="#l4" transform="translate(0,400) scale(0.3333333333333333)"/>
+      <use xlink:href="#l4" transform="translate(200,400) scale(0.3333333333333333)"/>
+      <use xlink:href="#l4" transform="translate(400,400) scale(0.3333333333333333)"/>
+      <use xlink:href="#l4" transform="translate(500,0) rotate(45) scale(0.233)"/>
+    </g>
+    <g id="l6">
+      <use xlink:href="#l5" transform="translate(0,0) scale(0.3333333333333333)"/>
+      <use xlink:href="#l5" transform="translate(200,0) scale(0.3333333333333333)"/>
+      <use xlink:href="#l5" transform="translate(0,200) scale(0.3333333333333333)"/>
+      <use xlink:href="#l5" transform="translate(200,200) scale(0.3333333333333333)"/>
+      <use xlink:href="#l5" transform="translate(400,200) scale(0.3333333333333333)"/>
+      <use xlink:href="#l5" transform="translate(0,400) scale(0.3333333333333333)"/>
+      <use xlink:href="#l5" transform="translate(200,400) scale(0.3333333333333333)"/>
+      <use xlink:href="#l5" transform="translate(400,400) scale(0.3333333333333333)"/>
+      <use xlink:href="#l5" transform="translate(500,0) rotate(45) scale(0.233)"/>
+    </g>
+    <g id="l7">
+      <use xlink:href="#l6" transform="translate(0,0) scale(0.3333333333333333)"/>
+      <use xlink:href="#l6" transform="translate(200,0) scale(0.3333333333333333)"/>
+      <use xlink:href="#l6" transform="translate(0,200) scale(0.3333333333333333)"/>
+      <use xlink:href="#l6" transform="translate(200,200) scale(0.3333333333333333)"/>
+      <use xlink:href="#l6" transform="translate(400,200) scale(0.3333333333333333)"/>
+      <use xlink:href="#l6" transform="translate(0,400) scale(0.3333333333333333)"/>
+      <use xlink:href="#l6" transform="translate(200,400) scale(0.3333333333333333)"/>
+      <use xlink:href="#l6" transform="translate(400,400) scale(0.3333333333333333)"/>
+      <use xlink:href="#l6" transform="translate(500,0) rotate(45) scale(0.233)"/>
+    </g>
+    <g id="l8">
+      <use xlink:href="#l7" transform="translate(0,0) scale(0.3333333333333333)"/>
+      <use xlink:href="#l7" transform="translate(200,0) scale(0.3333333333333333)"/>
+      <use xlink:href="#l7" transform="translate(0,200) scale(0.3333333333333333)"/>
+      <use xlink:href="#l7" transform="translate(200,200) scale(0.3333333333333333)"/>
+      <use xlink:href="#l7" transform="translate(400,200) scale(0.3333333333333333)"/>
+      <use xlink:href="#l7" transform="translate(0,400) scale(0.3333333333333333)"/>
+      <use xlink:href="#l7" transform="translate(200,400) scale(0.3333333333333333)"/>
+      <use xlink:href="#l7" transform="translate(400,400) scale(0.3333333333333333)"/>
+      <use xlink:href="#l7" transform="translate(500,0) rotate(45) scale(0.233)"/>
+    </g>
+    <g id="l9">
+      <use xlink:href="#l8" transform="translate(0,0) scale(0.3333333333333333)"/>
+      <use xlink:href="#l8" transform="translate(200,0) scale(0.3333333333333333)"/>
+      <use xlink:href="#l8" transform="translate(0,200) scale(0.3333333333333333)"/>
+      <use xlink:href="#l8" transform="translate(200,200) scale(0.3333333333333333)"/>
+      <use xlink:href="#l8" transform="translate(400,200) scale(0.3333333333333333)"/>
+      <use xlink:href="#l8" transform="translate(0,400) scale(0.3333333333333333)"/>
+      <use xlink:href="#l8" transform="translate(200,400) scale(0.3333333333333333)"/>
+      <use xlink:href="#l8" transform="translate(400,400) scale(0.3333333333333333)"/>
+      <use xlink:href="#l8" transform="translate(500,0) rotate(45) scale(0.233)"/>
+    </g>
+    <g id="l10">
+      <use xlink:href="#l9" transform="translate(0,0) scale(0.3333333333333333)"/>
+      <use xlink:href="#l9" transform="translate(200,0) scale(0.3333333333333333)"/>
+      <use xlink:href="#l9" transform="translate(0,200) scale(0.3333333333333333)"/>
+      <use xlink:href="#l9" transform="translate(200,200) scale(0.3333333333333333)"/>
+      <use xlink:href="#l9" transform="translate(400,200) scale(0.3333333333333333)"/>
+      <use xlink:href="#l9" transform="translate(0,400) scale(0.3333333333333333)"/>
+      <use xlink:href="#l9" transform="translate(200,400) scale(0.3333333333333333)"/>
+      <use xlink:href="#l9" transform="translate(400,400) scale(0.3333333333333333)"/>
+      <use xlink:href="#l9" transform="translate(500,0) rotate(45) scale(0.233)"/>
+    </g>
+    <g id="l11">
+      <use xlink:href="#l10" transform="translate(0,0) scale(0.3333333333333333)"/>
+      <use xlink:href="#l10" transform="translate(200,0) scale(0.3333333333333333)"/>
+      <use xlink:href="#l10" transform="translate(0,200) scale(0.3333333333333333)"/>
+      <use xlink:href="#l10" transform="translate(200,200) scale(0.3333333333333333)"/>
+      <use xlink:href="#l10" transform="translate(400,200) scale(0.3333333333333333)"/>
+      <use xlink:href="#l10" transform="translate(0,400) scale(0.3333333333333333)"/>
+      <use xlink:href="#l10" transform="translate(200,400) scale(0.3333333333333333)"/>
+      <use xlink:href="#l10" transform="translate(400,400) scale(0.3333333333333333)"/>
+      <use xlink:href="#l10" transform="translate(500,0) rotate(45) scale(0.233)"/>
+    </g>
+    <g id="l12">
+      <use xlink:href="#l11" transform="translate(0,0) scale(0.3333333333333333)"/>
+      <use xlink:href="#l11" transform="translate(200,0) scale(0.3333333333333333)"/>
+      <use xlink:href="#l11" transform="translate(0,200) scale(0.3333333333333333)"/>
+      <use xlink:href="#l11" transform="translate(200,200) scale(0.3333333333333333)"/>
+      <use xlink:href="#l11" transform="translate(400,200) scale(0.3333333333333333)"/>
+      <use xlink:href="#l11" transform="translate(0,400) scale(0.3333333333333333)"/>
+      <use xlink:href="#l11" transform="translate(200,400) scale(0.3333333333333333)"/>
+      <use xlink:href="#l11" transform="translate(400,400) scale(0.3333333333333333)"/>
+      <use xlink:href="#l11" transform="translate(500,0) rotate(45) scale(0.233)"/>
+    </g>
+    <g id="l13">
+      <use xlink:href="#l12" transform="translate(0,0) scale(0.3333333333333333)"/>
+      <use xlink:href="#l12" transform="translate(200,0) scale(0.3333333333333333)"/>
+      <use xlink:href="#l12" transform="translate(0,200) scale(0.3333333333333333)"/>
+      <use xlink:href="#l12" transform="translate(200,200) scale(0.3333333333333333)"/>
+      <use xlink:href="#l12" transform="translate(400,200) scale(0.3333333333333333)"/>
+      <use xlink:href="#l12" transform="translate(0,400) scale(0.3333333333333333)"/>
+      <use xlink:href="#l12" transform="translate(200,400) scale(0.3333333333333333)"/>
+      <use xlink:href="#l12" transform="translate(400,400) scale(0.3333333333333333)"/>
+      <use xlink:href="#l12" transform="translate(500,0) rotate(45) scale(0.233)"/>
+    </g>
+    <g id="l14">
+      <use xlink:href="#l13" transform="translate(0,0) scale(0.3333333333333333)"/>
+      <use xlink:href="#l13" transform="translate(200,0) scale(0.3333333333333333)"/>
+      <use xlink:href="#l13" transform="translate(0,200) scale(0.3333333333333333)"/>
+      <use xlink:href="#l13" transform="translate(200,200) scale(0.3333333333333333)"/>
+      <use xlink:href="#l13" transform="translate(400,200) scale(0.3333333333333333)"/>
+      <use xlink:href="#l13" transform="translate(0,400) scale(0.3333333333333333)"/>
+      <use xlink:href="#l13" transform="translate(200,400) scale(0.3333333333333333)"/>
+      <use xlink:href="#l13" transform="translate(400,400) scale(0.3333333333333333)"/>
+      <use xlink:href="#l13" transform="translate(500,0) rotate(45) scale(0.233)"/>
+    </g>
+    <g id="l15">
+      <use xlink:href="#l14" transform="translate(0,0) scale(0.3333333333333333)"/>
+      <use xlink:href="#l14" transform="translate(200,0) scale(0.3333333333333333)"/>
+      <use xlink:href="#l14" transform="translate(0,200) scale(0.3333333333333333)"/>
+      <use xlink:href="#l14" transform="translate(200,200) scale(0.3333333333333333)"/>
+      <use xlink:href="#l14" transform="translate(400,200) scale(0.3333333333333333)"/>
+      <use xlink:href="#l14" transform="translate(0,400) scale(0.3333333333333333)"/>
+      <use xlink:href="#l14" transform="translate(200,400) scale(0.3333333333333333)"/>
+      <use xlink:href="#l14" transform="translate(400,400) scale(0.3333333333333333)"/>
+      <use xlink:href="#l14" transform="translate(500,0) rotate(45) scale(0.233)"/>
+    </g>
+    <g id="l16">
+      <use xlink:href="#l15" transform="translate(0,0) scale(0.3333333333333333)"/>
+      <use xlink:href="#l15" transform="translate(200,0) scale(0.3333333333333333)"/>
+      <use xlink:href="#l15" transform="translate(0,200) scale(0.3333333333333333)"/>
+      <use xlink:href="#l15" transform="translate(200,200) scale(0.3333333333333333)"/>
+      <use xlink:href="#l15" transform="translate(400,200) scale(0.3333333333333333)"/>
+      <use xlink:href="#l15" transform="translate(0,400) scale(0.3333333333333333)"/>
+      <use xlink:href="#l15" transform="translate(200,400) scale(0.3333333333333333)"/>
+      <use xlink:href="#l15" transform="translate(400,400) scale(0.3333333333333333)"/>
+      <use xlink:href="#l15" transform="translate(500,0) rotate(45) scale(0.233)"/>
+    </g>
+    <g id="l17">
+      <use xlink:href="#l16" transform="translate(0,0) scale(0.3333333333333333)"/>
+      <use xlink:href="#l16" transform="translate(200,0) scale(0.3333333333333333)"/>
+      <use xlink:href="#l16" transform="translate(0,200) scale(0.3333333333333333)"/>
+      <use xlink:href="#l16" transform="translate(200,200) scale(0.3333333333333333)"/>
+      <use xlink:href="#l16" transform="translate(400,200) scale(0.3333333333333333)"/>
+      <use xlink:href="#l16" transform="translate(0,400) scale(0.3333333333333333)"/>
+      <use xlink:href="#l16" transform="translate(200,400) scale(0.3333333333333333)"/>
+      <use xlink:href="#l16" transform="translate(400,400) scale(0.3333333333333333)"/>
+      <use xlink:href="#l16" transform="translate(500,0) rotate(45) scale(0.233)"/>
+    </g>
+  </defs>
+  <use xlink:href="#l17" transform="scale(1)"/>
+</svg>
diff --git a/tests/fixtures/errors/515-pattern-billion-laughs.svg 
b/tests/fixtures/errors/515-pattern-billion-laughs.svg
new file mode 100644
index 00000000..1cb6cbe8
--- /dev/null
+++ b/tests/fixtures/errors/515-pattern-billion-laughs.svg
@@ -0,0 +1,130 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" 
+  "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd";>
+<svg width="40cm" height="20cm" viewBox="0 0 800 400" version="1.1"
+     xmlns="http://www.w3.org/2000/svg";>
+  <defs>
+    <pattern id="z" x="0" y="0" width="20" height="20" patternUnits="userSpaceOnUse" 
patternTransform="scale(10,10)">
+      <rect x="0" y="0" width="20" height="20" fill="url(#i)" stroke="yellow"/>
+    </pattern>
+       
+       <pattern id="i" x="0" y="0" width="20" height="20" patternUnits="userSpaceOnUse" 
patternTransform="scale(0.5,0.5)">
+      <rect x="0" y="0" width="20" height="20" fill="url(#h)" stroke="green" />
+         <rect x="1" y="1" width="20" height="20" fill="url(#h)" stroke="brown" />
+         <rect x="2" y="2" width="20" height="20" fill="url(#h)" stroke="pink" />
+         <rect x="3" y="3" width="20" height="20" fill="url(#h)" stroke="grey" />
+         <rect x="4" y="3" width="20" height="20" fill="url(#h)" stroke="cyan" />
+         <rect x="5" y="3" width="20" height="20" fill="url(#h)" stroke="green" />
+         <rect x="6" y="3" width="20" height="20" fill="url(#h)" stroke="brown" />
+         <rect x="7" y="3" width="20" height="20" fill="url(#h)" stroke="pink" />
+         <rect x="8" y="3" width="20" height="20" fill="url(#h)" stroke="grey" />
+         <rect x="9" y="3" width="20" height="20" fill="url(#h)" stroke="cyan" />
+    </pattern>
+       
+       <pattern id="h" x="0" y="0" width="20" height="20" patternUnits="userSpaceOnUse" 
patternTransform="scale(0.5,0.5)">
+      <rect x="0" y="0" width="20" height="20" fill="url(#g)" stroke="green" />
+         <rect x="1" y="1" width="20" height="20" fill="url(#g)" stroke="brown" />
+         <rect x="2" y="2" width="20" height="20" fill="url(#g)" stroke="pink" />
+         <rect x="3" y="3" width="20" height="20" fill="url(#g)" stroke="grey" />
+         <rect x="4" y="3" width="20" height="20" fill="url(#g)" stroke="cyan" />
+         <rect x="5" y="3" width="20" height="20" fill="url(#g)" stroke="green" />
+         <rect x="6" y="3" width="20" height="20" fill="url(#g)" stroke="brown" />
+         <rect x="7" y="3" width="20" height="20" fill="url(#g)" stroke="pink" />
+         <rect x="8" y="3" width="20" height="20" fill="url(#g)" stroke="grey" />
+         <rect x="9" y="3" width="20" height="20" fill="url(#g)" stroke="cyan" />
+    </pattern>
+       
+       <pattern id="g" x="0" y="0" width="20" height="20" patternUnits="userSpaceOnUse" 
patternTransform="scale(0.5,0.5)">
+      <rect x="0" y="0" width="20" height="20" fill="url(#f)" stroke="green" />
+         <rect x="1" y="1" width="20" height="20" fill="url(#f)" stroke="brown" />
+         <rect x="2" y="2" width="20" height="20" fill="url(#f)" stroke="pink" />
+         <rect x="3" y="3" width="20" height="20" fill="url(#f)" stroke="grey" />
+         <rect x="4" y="3" width="20" height="20" fill="url(#f)" stroke="cyan" />
+         <rect x="5" y="3" width="20" height="20" fill="url(#f)" stroke="green" />
+         <rect x="6" y="3" width="20" height="20" fill="url(#f)" stroke="brown" />
+         <rect x="7" y="3" width="20" height="20" fill="url(#f)" stroke="pink" />
+         <rect x="8" y="3" width="20" height="20" fill="url(#f)" stroke="grey" />
+         <rect x="9" y="3" width="20" height="20" fill="url(#f)" stroke="cyan" />
+    </pattern>
+       
+       <pattern id="f" x="0" y="0" width="20" height="20" patternUnits="userSpaceOnUse" 
patternTransform="scale(0.5,0.5)">
+      <rect x="0" y="0" width="20" height="20" fill="url(#e)" stroke="green" />
+         <rect x="1" y="1" width="20" height="20" fill="url(#e)" stroke="brown" />
+         <rect x="2" y="2" width="20" height="20" fill="url(#e)" stroke="pink" />
+         <rect x="3" y="3" width="20" height="20" fill="url(#e)" stroke="grey" />
+         <rect x="4" y="3" width="20" height="20" fill="url(#e)" stroke="cyan" />
+         <rect x="5" y="3" width="20" height="20" fill="url(#e)" stroke="green" />
+         <rect x="6" y="3" width="20" height="20" fill="url(#e)" stroke="brown" />
+         <rect x="7" y="3" width="20" height="20" fill="url(#e)" stroke="pink" />
+         <rect x="8" y="3" width="20" height="20" fill="url(#e)" stroke="grey" />
+         <rect x="9" y="3" width="20" height="20" fill="url(#e)" stroke="cyan" />
+    </pattern>
+       
+       <pattern id="e" x="0" y="0" width="20" height="20" patternUnits="userSpaceOnUse" 
patternTransform="scale(0.5,0.5)">
+      <rect x="0" y="0" width="20" height="20" fill="url(#d)" stroke="green" />
+         <rect x="1" y="1" width="20" height="20" fill="url(#d)" stroke="brown" />
+         <rect x="2" y="2" width="20" height="20" fill="url(#d)" stroke="pink" />
+         <rect x="3" y="3" width="20" height="20" fill="url(#d)" stroke="grey" />
+         <rect x="4" y="3" width="20" height="20" fill="url(#d)" stroke="cyan" />
+         <rect x="5" y="3" width="20" height="20" fill="url(#d)" stroke="green" />
+         <rect x="6" y="3" width="20" height="20" fill="url(#d)" stroke="brown" />
+         <rect x="7" y="3" width="20" height="20" fill="url(#d)" stroke="pink" />
+         <rect x="8" y="3" width="20" height="20" fill="url(#d)" stroke="grey" />
+         <rect x="9" y="3" width="20" height="20" fill="url(#d)" stroke="cyan" />
+    </pattern>
+       
+    <pattern id="d" x="0" y="0" width="20" height="20" patternUnits="userSpaceOnUse" 
patternTransform="scale(0.5,0.5)">
+      <rect x="0" y="0" width="20" height="20" fill="url(#c)" stroke="green" />
+         <rect x="1" y="1" width="20" height="20" fill="url(#c)" stroke="brown" />
+         <rect x="2" y="2" width="20" height="20" fill="url(#c)" stroke="pink" />
+         <rect x="3" y="3" width="20" height="20" fill="url(#c)" stroke="grey" />
+         <rect x="4" y="3" width="20" height="20" fill="url(#c)" stroke="cyan" />
+         <rect x="5" y="3" width="20" height="20" fill="url(#c)" stroke="green" />
+         <rect x="6" y="3" width="20" height="20" fill="url(#c)" stroke="brown" />
+         <rect x="7" y="3" width="20" height="20" fill="url(#c)" stroke="pink" />
+         <rect x="8" y="3" width="20" height="20" fill="url(#c)" stroke="grey" />
+         <rect x="9" y="3" width="20" height="20" fill="url(#c)" stroke="cyan" />
+    </pattern>
+    <pattern id="c" x="0" y="0" width="20" height="20" patternUnits="userSpaceOnUse" 
patternTransform="scale(0.5,0.5)">
+      <rect x="0" y="0" width="20" height="20" fill="url(#b)" stroke="green" />
+         <rect x="1" y="1" width="20" height="20" fill="url(#b)" stroke="brown" />
+         <rect x="2" y="2" width="20" height="20" fill="url(#b)" stroke="pink" />
+         <rect x="3" y="3" width="20" height="20" fill="url(#b)" stroke="grey" />
+         <rect x="4" y="3" width="20" height="20" fill="url(#b)" stroke="cyan" />
+         <rect x="5" y="3" width="20" height="20" fill="url(#b)" stroke="green" />
+         <rect x="6" y="3" width="20" height="20" fill="url(#b)" stroke="brown" />
+         <rect x="7" y="3" width="20" height="20" fill="url(#b)" stroke="pink" />
+         <rect x="8" y="3" width="20" height="20" fill="url(#b)" stroke="grey" />
+         <rect x="9" y="3" width="20" height="20" fill="url(#b)" stroke="cyan" />
+    </pattern>
+    <pattern id="b" x="0" y="0" width="20" height="20" patternUnits="userSpaceOnUse" 
patternTransform="scale(0.5,0.5)">
+         <rect x="0" y="0" width="20" height="20" fill="url(#a)" stroke="green" />
+         <rect x="1" y="1" width="20" height="20" fill="url(#a)" stroke="brown" />
+         <rect x="2" y="2" width="20" height="20" fill="url(#a)" stroke="pink" />
+         <rect x="3" y="3" width="20" height="20" fill="url(#a)" stroke="grey" />
+         <rect x="4" y="3" width="20" height="20" fill="url(#a)" stroke="cyan" />
+         <rect x="5" y="3" width="20" height="20" fill="url(#a)" stroke="green" />
+         <rect x="6" y="3" width="20" height="20" fill="url(#a)" stroke="brown" />
+         <rect x="7" y="3" width="20" height="20" fill="url(#a)" stroke="pink" />
+         <rect x="8" y="3" width="20" height="20" fill="url(#a)" stroke="grey" />
+         <rect x="9" y="3" width="20" height="20" fill="url(#a)" stroke="cyan" />
+         
+    </pattern>
+    <pattern id="a" x="0" y="0" width="20" height="20" patternUnits="userSpaceOnUse" 
patternTransform="scale(0.5,0.5)">
+      <rect x="0" y="0" width="20" height="20" fill="none" stroke="green" />
+         <rect x="1" y="1" width="20" height="20" fill="none" stroke="brown" />
+         <rect x="2" y="2" width="20" height="20" fill="none" stroke="pink" />
+         <rect x="3" y="3" width="20" height="20" fill="none" stroke="grey" />
+         <rect x="4" y="3" width="20" height="20" fill="none" stroke="cyan" />
+         <rect x="5" y="3" width="20" height="20" fill="none" stroke="green" />
+         <rect x="6" y="3" width="20" height="20" fill="none" stroke="brown" />
+         <rect x="7" y="3" width="20" height="20" fill="none" stroke="pink" />
+         <rect x="8" y="3" width="20" height="20" fill="none" stroke="grey" />
+         <rect x="9" y="3" width="20" height="20" fill="none" stroke="cyan" />
+    </pattern>
+  </defs>
+
+  <ellipse fill="url(#z)" stroke="black" stroke-width="5"  
+           cx="400" cy="200" rx="350" ry="150" />
+                  
+</svg>
\ No newline at end of file
diff --git a/tests/fixtures/errors/515-too-many-elements.svgz 
b/tests/fixtures/errors/515-too-many-elements.svgz
new file mode 100644
index 00000000..a7f7cf67
Binary files /dev/null and b/tests/fixtures/errors/515-too-many-elements.svgz differ


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]