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

Unified Diff: pdf/out_of_process_instance.cc

Issue 2648013002: Fix crash in PDF accessibility when PDF engine reports -1 as char count. (Closed)
Patch Set: Add test Created 3 years, 11 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
Index: pdf/out_of_process_instance.cc
diff --git a/pdf/out_of_process_instance.cc b/pdf/out_of_process_instance.cc
index bc0fb5b6c283d21ab47a559271489820a5a8cf46..5d90b39620b55a0d1834550f98e12d208eb1f3b6 100644
--- a/pdf/out_of_process_instance.cc
+++ b/pdf/out_of_process_instance.cc
@@ -747,6 +747,12 @@ void OutOfProcessInstance::SendNextAccessibilityPage(int32_t page_index) {
return;
int char_count = engine_->GetCharCount(page_index);
+
+ // Treat a char count of -1 (error) as 0 (an empty page), since
+ // other pages might have valid content.
+ if (char_count < 0)
+ char_count = 0;
+
PP_PrivateAccessibilityPageInfo page_info;
page_info.page_index = page_index;
page_info.bounds = engine_->GetPageBoundsRect(page_index);
« chrome/browser/pdf/pdf_extension_test.cc ('K') | « chrome/browser/pdf/pdf_extension_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698