summaryrefslogtreecommitdiff
path: root/core/fpdfapi
diff options
context:
space:
mode:
authorWei Li <weili@chromium.org>2018-05-31 17:29:12 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-05-31 17:29:12 +0000
commitdd5459ce862dfe709b88f698a28e72b31be6fb7c (patch)
tree770688822e61177ce278991679d5f326962c67ac /core/fpdfapi
parent4023c874911d5fbc9d18a4f00e1e6b30ab0194ee (diff)
downloadpdfium-dd5459ce862dfe709b88f698a28e72b31be6fb7c.tar.xz
Handle image mask continuous loading correctly
When image mask doesn't need multi-steps to load, ContinueLoadMaskDIB() will return LoadState::kFail as result. For this case, the loading should continue as usual instead of aborting. BUG=pdfium:1087 Change-Id: I5c43a67e43469ac7febca4c0cf1faa96ee105206 Reviewed-on: https://pdfium-review.googlesource.com/33310 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Wei Li <weili@chromium.org>
Diffstat (limited to 'core/fpdfapi')
-rw-r--r--core/fpdfapi/render/cpdf_dibsource.cpp6
-rw-r--r--core/fpdfapi/render/fpdf_render_loadimage_embeddertest.cpp9
2 files changed, 13 insertions, 2 deletions
diff --git a/core/fpdfapi/render/cpdf_dibsource.cpp b/core/fpdfapi/render/cpdf_dibsource.cpp
index 3a4ca02cc2..d1eba2e467 100644
--- a/core/fpdfapi/render/cpdf_dibsource.cpp
+++ b/core/fpdfapi/render/cpdf_dibsource.cpp
@@ -323,8 +323,10 @@ CPDF_DIBSource::LoadState CPDF_DIBSource::ContinueLoadDIBSource(
LoadState iContinueStatus = LoadState::kSuccess;
if (m_bHasMask) {
- iContinueStatus = ContinueLoadMaskDIB(pPause);
- m_Status = LoadState::kContinue;
+ if (ContinueLoadMaskDIB(pPause) == LoadState::kContinue) {
+ iContinueStatus = LoadState::kContinue;
+ m_Status = LoadState::kContinue;
+ }
}
if (iContinueStatus == LoadState::kContinue)
return LoadState::kContinue;
diff --git a/core/fpdfapi/render/fpdf_render_loadimage_embeddertest.cpp b/core/fpdfapi/render/fpdf_render_loadimage_embeddertest.cpp
index 5103d787bd..e3bd297afb 100644
--- a/core/fpdfapi/render/fpdf_render_loadimage_embeddertest.cpp
+++ b/core/fpdfapi/render/fpdf_render_loadimage_embeddertest.cpp
@@ -40,3 +40,12 @@ TEST_F(FPDFRenderLoadImageEmbeddertest, Bug_603518) {
CompareBitmap(bitmap.get(), 749, 749, "b9e75190cdc5edf0069a408744ca07dc");
UnloadPage(page);
}
+
+TEST_F(FPDFRenderLoadImageEmbeddertest, Bug_1087) {
+ EXPECT_TRUE(OpenDocument("bug_1087.pdf"));
+ FPDF_PAGE page = LoadPage(0);
+ ASSERT_TRUE(page);
+ ScopedFPDFBitmap bitmap = RenderLoadedPage(page);
+ CompareBitmap(bitmap.get(), 548, 238, "2aac40afa121feb0f38883cb04a55001");
+ UnloadPage(page);
+}