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

Unified Diff: third_party/WebKit/Source/core/layout/line/InlineTextBox.cpp

Issue 2588193003: Add RELEASE_ASSERT to InlineTextBox::constructTextRun (Closed)
Patch Set: Add comment Created 4 years 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: third_party/WebKit/Source/core/layout/line/InlineTextBox.cpp
diff --git a/third_party/WebKit/Source/core/layout/line/InlineTextBox.cpp b/third_party/WebKit/Source/core/layout/line/InlineTextBox.cpp
index 0dbf55c9d824a9a274c7926f7e30170c133a3824..6d01393db84bc2aaec7e7c0963a411d8d7199a74 100644
--- a/third_party/WebKit/Source/core/layout/line/InlineTextBox.cpp
+++ b/third_party/WebKit/Source/core/layout/line/InlineTextBox.cpp
@@ -616,6 +616,10 @@ TextRun InlineTextBox::constructTextRun(
String string = getLineLayoutItem().text();
unsigned startPos = start();
unsigned length = len();
+ // Ensure |this| is in sync with the corresponding LayoutText. Checking here
+ // has less binary size/perf impact than in StringView().
+ RELEASE_ASSERT(startPos <= string.length() &&
+ length <= string.length() - startPos);
return constructTextRun(style, StringView(string, startPos, length),
getLineLayoutItem().textLength() - startPos,
charactersWithHyphen);
« 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