Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(966)

Unified Diff: Source/core/svg/SVGAnimateElement.cpp

Issue 1171223004: Sanitize SVG animation attributes which could set JavaScript URL values. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/svg/SVGAnimateElement.cpp
diff --git a/Source/core/svg/SVGAnimateElement.cpp b/Source/core/svg/SVGAnimateElement.cpp
index 1a0c271c588b682896d0fd8ce7381eda592b3ac7..958447a8a6c57ed313d4e761bc55689be28d21ab 100644
--- a/Source/core/svg/SVGAnimateElement.cpp
+++ b/Source/core/svg/SVGAnimateElement.cpp
@@ -49,6 +49,26 @@ SVGAnimateElement::~SVGAnimateElement()
{
}
+bool SVGAnimateElement::isSVGAnimationAttributeSettingJavaScriptURL(const Attribute& attribute) const
+{
+ if ((attribute.name() == SVGNames::fromAttr || attribute.name() == SVGNames::toAttr) && attributeValueIsJavaScriptURL(attribute))
+ return true;
+
+ if (attribute.name() == SVGNames::valuesAttr) {
+ Vector<String> parts;
+ if (!parseValues(attribute.value(), parts)) {
+ // Assume the worst.
+ return true;
+ }
+ for (auto part : parts) {
dcheng 2015/06/10 09:35:28 This copies a String on each iteration. While Blin
+ if (protocolIsJavaScript(part))
+ return true;
+ }
+ }
+
+ return SVGSMILElement::isSVGAnimationAttributeSettingJavaScriptURL(attribute);
+}
+
AnimatedPropertyType SVGAnimateElement::animatedPropertyType()
{
if (!targetElement())

Powered by Google App Engine
This is Rietveld 408576698