Prove that the memory was good at FPDFBitmap_CreateEx() create time.

Diagnostic for the associated bug, not a bugfix. Helps rule out one
possible scenario.

Bug: chromium:838886
Change-Id: Ia56fda779407daf8e52a8b754800154fd7491ae7
Reviewed-on: https://pdfium-review.googlesource.com/32055
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/fpdfsdk/fpdf_view.cpp b/fpdfsdk/fpdf_view.cpp
index a31118f..f4a7610 100644
--- a/fpdfsdk/fpdf_view.cpp
+++ b/fpdfsdk/fpdf_view.cpp
@@ -27,6 +27,7 @@
 #include "core/fpdfdoc/cpdf_viewerpreferences.h"
 #include "core/fxcrt/fx_stream.h"
 #include "core/fxcrt/fx_system.h"
+#include "core/fxcrt/unowned_ptr.h"
 #include "core/fxge/cfx_defaultrenderdevice.h"
 #include "core/fxge/cfx_gemodule.h"
 #include "core/fxge/cfx_renderdevice.h"
@@ -854,11 +855,13 @@
     default:
       return nullptr;
   }
+
+  // Ensure external memory is good at least for the duration of this call.
+  UnownedPtr<uint8_t> pChecker(static_cast<uint8_t*>(first_scan));
   auto pBitmap = pdfium::MakeRetain<CFX_DIBitmap>();
-  if (!pBitmap->Create(width, height, fx_format,
-                       static_cast<uint8_t*>(first_scan), stride)) {
+  if (!pBitmap->Create(width, height, fx_format, pChecker.Get(), stride))
     return nullptr;
-  }
+
   return FPDFBitmapFromCFXDIBitmap(pBitmap.Leak());
 }