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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutText.cpp

Issue 2345633007: Don't overflow in LayoutText::width() on a huge length. (Closed)
Patch Set: Tweak test ranges for Mac results. Created 4 years, 3 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 | « third_party/WebKit/Source/core/BUILD.gn ('k') | third_party/WebKit/Source/core/layout/LayoutTextTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/LayoutText.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutText.cpp b/third_party/WebKit/Source/core/layout/LayoutText.cpp
index 2dbaf857cf174032c1a2b13fbfcf7879d8ff693e..8d3e6d24adf9a0871ac1f35682ed773fbb13b959 100644
--- a/third_party/WebKit/Source/core/layout/LayoutText.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutText.cpp
@@ -1575,7 +1575,7 @@ float LayoutText::width(unsigned from, unsigned len, LayoutUnit xPos, TextDirect
if (from >= textLength())
return 0;
- if (from + len > textLength())
+ if (len > textLength() || from + len > textLength())
len = textLength() - from;
return width(from, len, style(firstLine)->font(), xPos, textDirection, fallbackFonts, glyphBounds);
« no previous file with comments | « third_party/WebKit/Source/core/BUILD.gn ('k') | third_party/WebKit/Source/core/layout/LayoutTextTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698