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

Unified Diff: pdf/pdfium/pdfium_range.cc

Issue 848073003: PDF: Yet another stab at getting WriteInto() buffer sizes correct. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix accessibility code that can no longer occur Created 5 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
« pdf/pdfium/pdfium_page.cc ('K') | « pdf/pdfium/pdfium_page.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pdf/pdfium/pdfium_range.cc
diff --git a/pdf/pdfium/pdfium_range.cc b/pdf/pdfium/pdfium_range.cc
index 226d51284136ebb35fe0cd3b93c015da702224b9..c941d8e905fd6db99fadda0e04bbc57fb072a799 100644
--- a/pdf/pdfium/pdfium_range.cc
+++ b/pdf/pdfium/pdfium_range.cc
@@ -71,10 +71,12 @@ base::string16 PDFiumRange::GetText() {
// |written| includes the trailing terminator, so get rid of the trailing
// NUL character by calling resize().
int written = FPDFText_GetText(page_->GetTextPage(), index, count, data);
- if (written < 1)
- rv.resize(0);
- else
+ if (written > 0) {
+ DCHECK_EQ(L'\0', rv[written - 1]);
rv.resize(written - 1);
+ } else {
+ rv.clear();
+ }
}
return rv;
« pdf/pdfium/pdfium_page.cc ('K') | « pdf/pdfium/pdfium_page.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698