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

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

Issue 1133783003: Avoid division-by-zero in SVGLengthContext::convertValueFromUserUnits (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 7 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/svg/SVGLengthContext.cpp
diff --git a/Source/core/svg/SVGLengthContext.cpp b/Source/core/svg/SVGLengthContext.cpp
index b64cfd4b81ad9e7f96af5aeb5536c1d5ebee22b1..34e30e9b366908804ec16f133a72d840e047500b 100644
--- a/Source/core/svg/SVGLengthContext.cpp
+++ b/Source/core/svg/SVGLengthContext.cpp
@@ -249,9 +249,12 @@ float SVGLengthContext::convertValueFromUserUnits(float value, SVGLengthMode mod
FloatSize viewportSize;
if (!determineViewport(viewportSize))
return 0;
+ float dimension = dimensionForLengthMode(mode, viewportSize);
+ if (!dimension)
+ return 0;
// LengthTypePercentage is represented with 100% = 100.0.
// Good for accuracy but could eventually be changed.
- return value * 100 / dimensionForLengthMode(mode, viewportSize);
+ return value * 100 / dimension;
}
case LengthTypeEMS:
return convertValueFromUserUnitsToEMS(computedStyleForLengthResolving(m_context), value);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698