diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-05-08 11:53:53 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-05-08 11:53:53 -0700 |
commit | 17ea732e8c8bba793aa57644f2325eeaaf4a1cbd (patch) | |
tree | 85d9cc664672d7b5e67ebf648fa12221ed886b3a /samples | |
parent | 470408c2ffe71e99cebad0d1d6887f1723f02cef (diff) | |
download | pdfium-17ea732e8c8bba793aa57644f2325eeaaf4a1cbd.tar.xz |
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
Diffstat (limited to 'samples')
-rw-r--r-- | samples/pdfium_test.cc | 6 |
1 files changed, 6 insertions, 0 deletions
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<int>(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 ++; |