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

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: 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') | ui/gfx/render_text_unittest.cc » ('J')
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 a2610f3787288305adb7f9d3c7b07044d8391511..d6c26c0ab1446b53ec9d6afb7322b76cc39b7d37 100644
--- a/ui/gfx/render_text_harfbuzz.cc
+++ b/ui/gfx/render_text_harfbuzz.cc
@@ -1165,6 +1165,7 @@ void RenderTextHarfBuzz::ItemizeTextToRuns(
run->underline = style.style(UNDERLINE);
int32 script_item_break = 0;
bidi_iterator.GetLogicalRun(run_break, &script_item_break, &run->level);
+
// Odd BiDi embedding levels correspond to RTL runs.
run->is_rtl = (run->level % 2) == 1;
// Find the length and script of this script run.
@@ -1183,6 +1184,9 @@ void RenderTextHarfBuzz::ItemizeTextToRuns(
if (run_break > run->range.start())
run_break = FindRunBreakingCharacter(text, run->range.start(), run_break);
+ if (run_break <= run->range.start())
+ run_break = std::max(script_item_break, run_break + 1);
+
DCHECK(IsValidCodePointIndex(text, run_break));
style.UpdatePosition(DisplayIndexToTextIndex(run_break));
run->range.set_end(run_break);
« no previous file with comments | « no previous file | ui/gfx/render_text_unittest.cc » ('j') | ui/gfx/render_text_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698