[gtk/matthiasc/for-master: 10/11] cssfiltervalue: Reject invalid filters
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/matthiasc/for-master: 10/11] cssfiltervalue: Reject invalid filters
- Date: Sat, 6 Feb 2021 21:17:13 +0000 (UTC)
commit 5f48764ac8082219de029f59f405b8b483b14aaa
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Feb 5 22:59:20 2021 -0500
cssfiltervalue: Reject invalid filters
The Filter Effects Spec doesn't allow negative values
for most of the filter parameters.
gtk/gtkcssfiltervalue.c | 4 ++--
testsuite/css/parser/invalid-filter1.css | 3 +++
testsuite/css/parser/invalid-filter1.errors | 1 +
testsuite/css/parser/invalid-filter1.ref.css | 0
4 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkcssfiltervalue.c b/gtk/gtkcssfiltervalue.c
index eaf11c16b5..c1c281c1e2 100644
--- a/gtk/gtkcssfiltervalue.c
+++ b/gtk/gtkcssfiltervalue.c
@@ -755,7 +755,7 @@ gtk_css_filter_parse_number (GtkCssParser *parser,
{
GtkCssValue **values = data;
- values[n] = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_NUMBER | GTK_CSS_PARSE_PERCENT);
+ values[n] = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_NUMBER | GTK_CSS_PARSE_PERCENT |
GTK_CSS_POSITIVE_ONLY);
if (values[n] == NULL)
return 0;
@@ -769,7 +769,7 @@ gtk_css_filter_parse_length (GtkCssParser *parser,
{
GtkCssValue **values = data;
- values[n] = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_LENGTH);
+ values[n] = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_LENGTH | GTK_CSS_POSITIVE_ONLY);
if (values[n] == NULL)
return 0;
diff --git a/testsuite/css/parser/invalid-filter1.css b/testsuite/css/parser/invalid-filter1.css
new file mode 100644
index 0000000000..52580b853e
--- /dev/null
+++ b/testsuite/css/parser/invalid-filter1.css
@@ -0,0 +1,3 @@
+a {
+ filter: blur(-1px);
+}
diff --git a/testsuite/css/parser/invalid-filter1.errors b/testsuite/css/parser/invalid-filter1.errors
new file mode 100644
index 0000000000..b91e500d69
--- /dev/null
+++ b/testsuite/css/parser/invalid-filter1.errors
@@ -0,0 +1 @@
+invalid-filter1.css:2:20-21: error: GTK_CSS_PARSER_ERROR_SYNTAX
diff --git a/testsuite/css/parser/invalid-filter1.ref.css b/testsuite/css/parser/invalid-filter1.ref.css
new file mode 100644
index 0000000000..e69de29bb2
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]