[librsvg: 6/7] parse_one_presentation_attribute - Do expect_exhausted here




commit f798883ec400143eed21da5ccaa50b2aa5260277
Author: Federico Mena Quintero <federico gnome org>
Date:   Thu Sep 3 21:30:44 2020 -0500

    parse_one_presentation_attribute - Do expect_exhausted here
    
    This works similar to Parse::parse_str - it is expected to parse a
    single value from the whole string in the attribute's value.

 rsvg_internals/src/properties.rs | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/rsvg_internals/src/properties.rs b/rsvg_internals/src/properties.rs
index 1a02b206..57e808c5 100644
--- a/rsvg_internals/src/properties.rs
+++ b/rsvg_internals/src/properties.rs
@@ -642,7 +642,17 @@ impl SpecifiedValues {
         // attribute like marker="#foo" and it needs to be set in the style attribute
         // like style="marker: #foo;".  So, pass false for accept_shorthands here.
         match parse_property(&attr, &mut parser, false) {
-            Ok(prop) => self.set_parsed_property(&prop),
+            Ok(prop) => {
+                if parser.expect_exhausted().is_ok() {
+                    self.set_parsed_property(&prop);
+                } else {
+                    rsvg_log!(
+                        "(ignoring invalid presentation attribute {:?}\n    value=\"{}\")\n",
+                        attr.expanded(),
+                        value,
+                    );
+                }
+            }
 
             // not a presentation attribute; just ignore it
             Err(ParseError {


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