]> gitweb.michael.orlitzky.com - libsvgtiny.git/commitdiff
src/svgtiny_css.c: empty substrings don't match anything in CSS
authorMichael Orlitzky <michael@orlitzky.com>
Tue, 22 Oct 2024 10:40:07 +0000 (06:40 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Tue, 22 Oct 2024 10:40:07 +0000 (06:40 -0400)
The _node_has_attribute_substring() function is responsible for
handling foo[bar*=baz] selectors. It returns "match" by reference, but
there's a special case early on for the empty substring that did not
set *match to false. This could lead to it being used ininitialized by
the caller.

src/svgtiny_css.c

index 4856ac3f7bdefe4856f4bbf49415b6bf2c796415..bdd12b3b3edf36b51e079ef613c0ecd6cde7a607 100644 (file)
@@ -1216,6 +1216,7 @@ static css_error _node_has_attribute_substring(void *pw, void *node,
        if (substrlen == 0) {
                /* In this case, the spec says that "if 'val' is the
                 * empty string, it will never represent anything." */
+               *match = false;
                return CSS_OK;
        }