Commit 94b3728a authored by Henrique Nakashima's avatar Henrique Nakashima Committed by Commit Bot

Copy visible_pages_ when iterating over it.

On this case, a call inside the loop may cause visible_pages_ to
change.

Bug: 822091
Change-Id: I41b0715faa6fe3e39203cd9142cf5ea38e59aefb
Reviewed-on: https://chromium-review.googlesource.com/964592Reviewed-by: default avatardsinclair <dsinclair@chromium.org>
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543494}
parent bdeb5712
...@@ -3742,7 +3742,10 @@ void PDFiumEngine::DeviceToPage(int page_index, ...@@ -3742,7 +3742,10 @@ void PDFiumEngine::DeviceToPage(int page_index,
} }
int PDFiumEngine::GetVisiblePageIndex(FPDF_PAGE page) { int PDFiumEngine::GetVisiblePageIndex(FPDF_PAGE page) {
for (int page_index : visible_pages_) { // Copy visible_pages_ since it can change as a result of loading the page in
// GetPage(). See https://crbug.com/822091.
std::vector<int> visible_pages_copy(visible_pages_);
for (int page_index : visible_pages_copy) {
if (pages_[page_index]->GetPage() == page) if (pages_[page_index]->GetPage() == page)
return page_index; return page_index;
} }
......
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