[gtk/wip/otte/for-main: 2/2] css: Don't crash on invalid rotate3d()




commit fce9b35e4df99fdc6a35b5d80aecf09f6809aeae
Author: Benjamin Otte <otte redhat com>
Date:   Sun Dec 26 22:58:09 2021 +0100

    css: Don't crash on invalid rotate3d()

 gtk/gtkcsstransformvalue.c                  | 2 +-
 testsuite/css/parser/meson.build            | 3 +++
 testsuite/css/parser/rotate3d-crash.css     | 3 +++
 testsuite/css/parser/rotate3d-crash.errors  | 1 +
 testsuite/css/parser/rotate3d-crash.ref.css | 0
 5 files changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtkcsstransformvalue.c b/gtk/gtkcsstransformvalue.c
index 6cec8cd7c0..0b59cdee87 100644
--- a/gtk/gtkcsstransformvalue.c
+++ b/gtk/gtkcsstransformvalue.c
@@ -942,7 +942,7 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
 
   while (TRUE)
     {
-      GtkCssTransform transform;
+      GtkCssTransform transform = { 0, };
 
       if (gtk_css_parser_has_function (parser, "matrix"))
         {
diff --git a/testsuite/css/parser/meson.build b/testsuite/css/parser/meson.build
index 07f2ca4a73..d0fdd0d9a9 100644
--- a/testsuite/css/parser/meson.build
+++ b/testsuite/css/parser/meson.build
@@ -452,6 +452,9 @@ test_data = [
   'radial-positions.errors',
   'radial-positions.ref.css',
   'radial.ref.css',
+  'rotate3d-crash.css',
+  'rotate3d-crash.errors',
+  'rotate3d-crash.ref.css',
   'selector.css',
   'selector.ref.css',
   'selector-original.css',
diff --git a/testsuite/css/parser/rotate3d-crash.css b/testsuite/css/parser/rotate3d-crash.css
new file mode 100644
index 0000000000..7e0b45c24a
--- /dev/null
+++ b/testsuite/css/parser/rotate3d-crash.css
@@ -0,0 +1,3 @@
+* {
+  transform: rotate3d(90,90,90);
+}
diff --git a/testsuite/css/parser/rotate3d-crash.errors b/testsuite/css/parser/rotate3d-crash.errors
new file mode 100644
index 0000000000..57ab5b7341
--- /dev/null
+++ b/testsuite/css/parser/rotate3d-crash.errors
@@ -0,0 +1 @@
+rotate3d-crash.css:2:31-32: error: GTK_CSS_PARSER_ERROR_SYNTAX
diff --git a/testsuite/css/parser/rotate3d-crash.ref.css b/testsuite/css/parser/rotate3d-crash.ref.css
new file mode 100644
index 0000000000..e69de29bb2


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