summaryrefslogtreecommitdiff
path: root/samples/pdfium_test.cc
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-05-08 12:02:05 -0700
committerTom Sepez <tsepez@chromium.org>2015-05-08 12:02:05 -0700
commitbad79b3b02c9c56cf4eef436116bc9ad1bfb65b0 (patch)
treed9efb7fd321878c1f5f3968f007868e79dae6bbc /samples/pdfium_test.cc
parent2f2c1183e68ef4e9d5484bfeec00e19019454c84 (diff)
downloadpdfium-bad79b3b02c9c56cf4eef436116bc9ad1bfb65b0.tar.xz
Merge to XFA: Better error from pdfium_test when page too big to render.
Original Review URL: https://codereview.chromium.org/1124423006 BUG=pdfium:114 TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1137753003
Diffstat (limited to 'samples/pdfium_test.cc')
-rw-r--r--samples/pdfium_test.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/samples/pdfium_test.cc b/samples/pdfium_test.cc
index e4a55f27ff..52e0125f09 100644
--- a/samples/pdfium_test.cc
+++ b/samples/pdfium_test.cc
@@ -518,6 +518,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 ++;