From bad79b3b02c9c56cf4eef436116bc9ad1bfb65b0 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Fri, 8 May 2015 12:02:05 -0700 Subject: 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 --- fpdfsdk/src/fpdfview.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'fpdfsdk') diff --git a/fpdfsdk/src/fpdfview.cpp b/fpdfsdk/src/fpdfview.cpp index c9d9a25580..c0b65cae05 100644 --- a/fpdfsdk/src/fpdfview.cpp +++ b/fpdfsdk/src/fpdfview.cpp @@ -11,6 +11,7 @@ #include "../include/fpdf_progressive.h" #include "../include/fpdf_ext.h" #include "../../../core/src/fxcrt/fx_safe_types.h" +#include "../../third_party/base/nonstd_unique_ptr.h" #include "../../third_party/base/numerics/safe_conversions_impl.h" #include "../include/fpdfformfill.h" #include "../include/fpdfxfa/fpdfxfa_doc.h" @@ -710,9 +711,11 @@ DLLEXPORT void STDCALL FPDF_PageToDevice(FPDF_PAGE page, int start_x, int start_ DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_Create(int width, int height, int alpha) { - CFX_DIBitmap* pBitmap = FX_NEW CFX_DIBitmap; - pBitmap->Create(width, height, alpha ? FXDIB_Argb : FXDIB_Rgb32); - return pBitmap; + nonstd::unique_ptr pBitmap(new CFX_DIBitmap); + if (!pBitmap->Create(width, height, alpha ? FXDIB_Argb : FXDIB_Rgb32)) { + return NULL; + } + return pBitmap.release(); } DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_CreateEx(int width, int height, int format, void* first_scan, int stride) -- cgit v1.2.3