Commit ed224aa6 authored by Lei Zhang's avatar Lei Zhang Committed by Commit Bot

Add some DCHECK in PDFiumRange::GetScreenRects().

Make sure the start index passed to FPDFText_CountRects() is valid.

BUG=823374

Change-Id: I5407fa2d169acd71b860322d280fee11536c85bc
Reviewed-on: https://chromium-review.googlesource.com/972678Reviewed-by: default avatardsinclair <dsinclair@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Cr-Commit-Position: refs/heads/master@{#544759}
parent 6a99e201
......@@ -46,6 +46,10 @@ const std::vector<pp::Rect>& PDFiumRange::GetScreenRects(
char_count *= -1;
char_index -= char_count - 1;
}
DCHECK_GE(char_index, 0) << "start: " << char_index_
<< " count: " << char_count_;
DCHECK_LT(char_index, FPDFText_CountChars(page_->GetTextPage()))
<< "start: " << char_index_ << " count: " << char_count_;
int count = FPDFText_CountRects(page_->GetTextPage(), char_index, char_count);
for (int i = 0; i < count; ++i) {
......
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