summaryrefslogtreecommitdiff
path: root/core/fpdfapi
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi')
-rw-r--r--core/fpdfapi/page/cpdf_image.cpp8
-rw-r--r--core/fpdfapi/render/cpdf_dibsource.cpp4
-rw-r--r--core/fpdfapi/render/cpdf_dibsource.h2
3 files changed, 13 insertions, 1 deletions
diff --git a/core/fpdfapi/page/cpdf_image.cpp b/core/fpdfapi/page/cpdf_image.cpp
index 8ce4185446..b74de62250 100644
--- a/core/fpdfapi/page/cpdf_image.cpp
+++ b/core/fpdfapi/page/cpdf_image.cpp
@@ -331,7 +331,13 @@ RetainPtr<CFX_DIBSource> CPDF_Image::LoadDIBSource() const {
if (!source->Load(m_pDocument.Get(), m_pStream.Get()))
return nullptr;
- return source;
+ if (!source->IsJBigImage())
+ return source;
+
+ CPDF_DIBSource::LoadState ret = CPDF_DIBSource::LoadState::kContinue;
+ while (ret == CPDF_DIBSource::LoadState::kContinue)
+ ret = source->ContinueLoadDIBSource(nullptr);
+ return ret == CPDF_DIBSource::LoadState::kSuccess ? source : nullptr;
}
RetainPtr<CFX_DIBSource> CPDF_Image::DetachBitmap() {
diff --git a/core/fpdfapi/render/cpdf_dibsource.cpp b/core/fpdfapi/render/cpdf_dibsource.cpp
index 8a752374b6..3c8d471767 100644
--- a/core/fpdfapi/render/cpdf_dibsource.cpp
+++ b/core/fpdfapi/render/cpdf_dibsource.cpp
@@ -708,6 +708,10 @@ RetainPtr<CPDF_DIBSource> CPDF_DIBSource::DetachMask() {
return std::move(m_pMask);
}
+bool CPDF_DIBSource::IsJBigImage() const {
+ return m_pStreamAcc->GetImageDecoder() == "JBIG2Decode";
+}
+
CPDF_DIBSource::LoadState CPDF_DIBSource::StartLoadMaskDIB() {
m_pMask = pdfium::MakeRetain<CPDF_DIBSource>();
LoadState ret = m_pMask->StartLoadDIBSource(
diff --git a/core/fpdfapi/render/cpdf_dibsource.h b/core/fpdfapi/render/cpdf_dibsource.h
index a3e44c57e7..a29385f6ad 100644
--- a/core/fpdfapi/render/cpdf_dibsource.h
+++ b/core/fpdfapi/render/cpdf_dibsource.h
@@ -76,6 +76,8 @@ class CPDF_DIBSource : public CFX_DIBSource {
LoadState ContinueLoadDIBSource(IFX_PauseIndicator* pPause);
RetainPtr<CPDF_DIBSource> DetachMask();
+ bool IsJBigImage() const;
+
private:
CPDF_DIBSource();