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

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: Thanks for feedback. 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
« no previous file with comments | « Source/core/svg/SVGAnimateElement.h ('k') | Source/core/svg/SVGAnimationElement.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/svg/SVGAnimateElement.cpp
diff --git a/Source/core/svg/SVGAnimateElement.cpp b/Source/core/svg/SVGAnimateElement.cpp
index 1a0c271c588b682896d0fd8ce7381eda592b3ac7..ea8c6ee4d89d6a03aba2bdaf62b3a66ea380219d 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 (const auto& part : parts) {
+ if (protocolIsJavaScript(part))
+ return true;
+ }
+ }
+
+ return SVGSMILElement::isSVGAnimationAttributeSettingJavaScriptURL(attribute);
+}
+
AnimatedPropertyType SVGAnimateElement::animatedPropertyType()
{
if (!targetElement())
« no previous file with comments | « Source/core/svg/SVGAnimateElement.h ('k') | Source/core/svg/SVGAnimationElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698