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

Unified Diff: ui/gfx/render_text_harfbuzz.cc

Issue 993153003: Prevent infinite loop about itemizing text in RenderTextHarfBuzz. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 5 years, 9 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 | ui/gfx/render_text_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/render_text_harfbuzz.cc
diff --git a/ui/gfx/render_text_harfbuzz.cc b/ui/gfx/render_text_harfbuzz.cc
index 3c71cff58c57c1b5dabf7aacff9bf7cc9764be6e..a60cc8499a388bd36d014376b810a1c55756ce2a 100644
--- a/ui/gfx/render_text_harfbuzz.cc
+++ b/ui/gfx/render_text_harfbuzz.cc
@@ -1151,7 +1151,11 @@ void RenderTextHarfBuzz::ItemizeTextToRuns(
// Build the run list from the script items and ranged styles and baselines.
// Use an empty color BreakList to avoid breaking runs at color boundaries.
BreakList<SkColor> empty_colors;
- empty_colors.SetMax(text.length());
+ // StyleIterator is specified over the text, which can be different from
+ // |text| variable given in the argument. Therefore its max should be
+ // the text length, not "text->length()", otherwise it prevents to reach
+ // to the end of the given text in the loop below.
+ empty_colors.SetMax(this->text().length());
msw 2015/03/24 01:56:31 Just use colors().max() and remove this comment.
internal::StyleIterator style(empty_colors, baselines(), styles());
for (size_t run_break = 0; run_break < text.length();) {
« no previous file with comments | « no previous file | ui/gfx/render_text_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698