Commit 74c7fa91 authored by kojii's avatar kojii Committed by Commit bot

Add RELEASE_ASSERT to InlineTextBox::constructTextRun

This patch adds RELEASE_CHECK of offset and length to
InlineTextBox::constructTextRun(). StringView constructor only does
SECURITY_DCHECK intentionally, see http://crrev.com/2587863002.

BUG=671328

Review-Url: https://codereview.chromium.org/2588193003
Cr-Commit-Position: refs/heads/master@{#439721}
parent 629f4bd2
...@@ -616,6 +616,10 @@ TextRun InlineTextBox::constructTextRun( ...@@ -616,6 +616,10 @@ TextRun InlineTextBox::constructTextRun(
String string = getLineLayoutItem().text(); String string = getLineLayoutItem().text();
unsigned startPos = start(); unsigned startPos = start();
unsigned length = len(); 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), return constructTextRun(style, StringView(string, startPos, length),
getLineLayoutItem().textLength() - startPos, getLineLayoutItem().textLength() - startPos,
charactersWithHyphen); charactersWithHyphen);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment