[librsvg: 3/7] Ensure that <transform-list> is not empty in the transform property
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 3/7] Ensure that <transform-list> is not empty in the transform property
- Date: Wed, 1 Sep 2021 00:59:51 +0000 (UTC)
commit 6e18a523c942fdb8c985b9d71f56cd5ee61d7ba3
Author: Federico Mena Quintero <federico gnome org>
Date: Tue Aug 31 17:53:33 2021 -0500
Ensure that <transform-list> is not empty in the transform property
Whereas the SVG1.1 attribute allows transform="", the SVG2 property
must not have an empty list of <transform-function>.
Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/582>
src/transform.rs | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/src/transform.rs b/src/transform.rs
index 40a7e57f..e7c493c5 100644
--- a/src/transform.rs
+++ b/src/transform.rs
@@ -109,11 +109,11 @@ fn parse_transform_prop_function_list<'i>(
let mut v = Vec::<TransformFunction>::new();
loop {
+ v.push(parse_transform_prop_function_command(parser)?);
+
if parser.is_exhausted() {
break;
}
-
- v.push(parse_transform_prop_function_command(parser)?);
}
Ok(v)
@@ -900,6 +900,15 @@ mod tests {
);
}
+ #[test]
+ fn empty_transform_property_is_error() {
+ // https://www.w3.org/TR/css-transforms-1/#transform-property
+ //
+ // <transform-list> = <transform-function>+
+ // ^ one or more required
+ assert!(parse_transform_prop("").is_err());
+ }
+
#[test]
fn test_parse_transform_property_matrix() {
let tp = TransformProperty::List(vec![TransformFunction::Matrix(
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]