From 17ea732e8c8bba793aa57644f2325eeaaf4a1cbd Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Fri, 8 May 2015 11:53:53 -0700 Subject: Better error from pdfium_test when page too big to render. BUG=pdfium:114 R=thestig@chromium.org Review URL: https://codereview.chromium.org/1124423006 --- samples/pdfium_test.cc | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'samples') diff --git a/samples/pdfium_test.cc b/samples/pdfium_test.cc index 068dbaa767..d473c4716a 100644 --- a/samples/pdfium_test.cc +++ b/samples/pdfium_test.cc @@ -505,6 +505,12 @@ void RenderPdf(const std::string& name, const char* pBuf, size_t len, int height = static_cast(FPDF_GetPageHeight(page) * scale); FPDF_BITMAP bitmap = FPDFBitmap_Create(width, height, 0); + if (!bitmap) { + fprintf(stderr, "Page was too large to be rendered.\n"); + bad_pages++; + continue; + } + FPDFBitmap_FillRect(bitmap, 0, 0, width, height, 0xFFFFFFFF); FPDF_RenderPageBitmap(bitmap, page, 0, 0, width, height, 0, 0); rendered_pages ++; -- cgit v1.2.3