From 008604d239a5bd2207c867b8967d407b3d058d8d Mon Sep 17 00:00:00 2001 From: "pdfium-autoroll@skia-public.iam.gserviceaccount.com" Date: Sun, 1 Nov 2026 20:52:25 -0800 Subject: [PATCH 01/14] Roll Jinja2 from c3027d884967 to fde3c16799bd (1 revision) https://chromium.googlesource.com/chromium/src/third_party/jinja2.git/+log/c3027d884967..fde3c16799bd If this roll has caused a breakage, revert this CL and set the roller to dry run mode using the controls here: https://autoroll.skia.org/r/jinja2-pdfium Please CC dhoss@chromium.org,thestig@chromium.org,thestig@google.com on the revert to ensure that a human is aware of the problem. To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md Bug: None Change-Id: I25a3ba2f0ffb1c0887600e164c7f614cd533a163 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/162870 Bot-Commit: pdfium-autoroll@skia-public.iam.gserviceaccount.com Commit-Queue: pdfium-autoroll@skia-public.iam.gserviceaccount.com --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index 2baa91ef5..69862189a 100644 --- a/DEPS +++ b/DEPS @@ -174,7 +174,7 @@ vars = { # Three lines of non-changing comments so that # the commit queue can handle CLs rolling jinja2 # and whatever else without interference from each other. - 'jinja2_revision': 'c3027d884967773057bf74b957e3fea87e5df4d7', + 'jinja2_revision': 'fde3c16799bd5937e4f15aedc9037c89f96236b9', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling jpeg_turbo # and whatever else without interference from each other. From 8033ab4e6d7f76abc6487593123fd688c9f65441 Mon Sep 17 00:00:00 2001 From: "pdfium-autoroll@skia-public.iam.gserviceaccount.com" Date: Sun, 1 Nov 2026 20:53:02 -0800 Subject: [PATCH 02/14] Roll Catapult from e1165abbf12a to c29dedc30c9f (22 revisions) https://chromium.googlesource.com/catapult.git/+log/e1165abbf12a..c29dedc30c9f If this roll has caused a breakage, revert this CL and set the roller to dry run mode using the controls here: https://autoroll.skia.org/r/catapult-pdfium Please CC dhoss@chromium.org,thestig@chromium.org,thestig@google.com on the revert to ensure that a human is aware of the problem. To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md Bug: None Change-Id: I8465c2a86ffaa39596c8bdcfa473364f9e3dba24 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/162871 Bot-Commit: pdfium-autoroll@skia-public.iam.gserviceaccount.com Commit-Queue: pdfium-autoroll@skia-public.iam.gserviceaccount.com --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index 69862189a..91465baf4 100644 --- a/DEPS +++ b/DEPS @@ -102,7 +102,7 @@ vars = { # Three lines of non-changing comments so that # the commit queue can handle CLs rolling catapult # and whatever else without interference from each other. - 'catapult_revision': 'e1165abbf12a3d9ecf2d3151a404c930b5047894', + 'catapult_revision': 'c29dedc30c9ff1b0cc677e32a9a959ad5ed41bde', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling clang format # and whatever else without interference from each other. From 69856420ff400df40d9e8789538e84c10283dfb1 Mon Sep 17 00:00:00 2001 From: "pdfium-autoroll@skia-public.iam.gserviceaccount.com" Date: Sun, 1 Nov 2026 21:39:41 -0800 Subject: [PATCH 03/14] Roll Zlib from 456ae730017b to 9f9f52c60a14 (1 revision) https://chromium.googlesource.com/chromium/src/third_party/zlib.git/+log/456ae730017b..9f9f52c60a14 If this roll has caused a breakage, revert this CL and set the roller to dry run mode using the controls here: https://autoroll.skia.org/r/zlib-pdfium Please CC thestig@chromium.org,thestig@google.com on the revert to ensure that a human is aware of the problem. To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md Bug: None Change-Id: I6da52876900e0dfb62c4398bcc151df2530b2d4a Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/162890 Bot-Commit: pdfium-autoroll@skia-public.iam.gserviceaccount.com Commit-Queue: pdfium-autoroll@skia-public.iam.gserviceaccount.com --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index 91465baf4..3241a202a 100644 --- a/DEPS +++ b/DEPS @@ -272,7 +272,7 @@ vars = { # Three lines of non-changing comments so that # the commit queue can handle CLs rolling zlib # and whatever else without interference from each other. - 'zlib_revision': '456ae730017b9b4bd3371927abc82627fd51feef', + 'zlib_revision': '9f9f52c60a14e8e772fb561029ae0a121fef7609', } # Only these hosts are allowed for dependencies in this DEPS file. From bc5a4257b38111b11f024b6435b5d35a87cb8aaf Mon Sep 17 00:00:00 2001 From: Fumitoshi Ukai Date: Mon, 2 Nov 2026 09:48:28 -0800 Subject: [PATCH 04/14] Remove obsolete reproxy.cfg generation from DEPS Reclient (reproxy) and buildtools/reclient have been removed. Merge the download_and_configure_reclient_cfgs hooks in DEPS and stop passing --reproxy_cfg_template and --use_luci_auth_credshelper. Bug: 379584977 Change-Id: I65c1511676521f04e0d2f55f9ef4c9edfaf37590 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/162850 Commit-Queue: Lei Zhang Reviewed-by: Lei Zhang Auto-Submit: Fumitoshi Ukai --- DEPS | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/DEPS b/DEPS index 3241a202a..682ba902f 100644 --- a/DEPS +++ b/DEPS @@ -1005,31 +1005,13 @@ hooks = [ }, # Configure remote exec cfg files { - # Use luci_auth if on windows and using chrome-untrusted project 'name': 'download_and_configure_reclient_cfgs', 'pattern': '.', - 'condition': 'download_remoteexec_cfg and host_os == "win"', + 'condition': 'download_remoteexec_cfg', 'action': ['python3', 'buildtools/reclient_cfgs/configure_reclient_cfgs.py', '--rbe_instance', Var('rbe_instance'), - '--reproxy_cfg_template', - 'reproxy.cfg.template', - '--rewrapper_cfg_project', - Var('rewrapper_cfg_project'), - '--use_luci_auth_credshelper', - '--quiet', - ], - }, { - 'name': 'download_and_configure_reclient_cfgs', - 'pattern': '.', - 'condition': 'download_remoteexec_cfg and not host_os == "win"', - 'action': ['python3', - 'buildtools/reclient_cfgs/configure_reclient_cfgs.py', - '--rbe_instance', - Var('rbe_instance'), - '--reproxy_cfg_template', - 'reproxy.cfg.template', '--rewrapper_cfg_project', Var('rewrapper_cfg_project'), '--quiet', @@ -1043,8 +1025,6 @@ hooks = [ 'buildtools/reclient_cfgs/configure_reclient_cfgs.py', '--rbe_instance', Var('rbe_instance'), - '--reproxy_cfg_template', - 'reproxy.cfg.template', '--rewrapper_cfg_project', Var('rewrapper_cfg_project'), '--skip_remoteexec_cfg_fetch', From 42ca519616777f5f9631ee4005f7aeec0dbe7c13 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Mon, 2 Nov 2026 10:44:00 -0800 Subject: [PATCH 05/14] Roll tools/win/ ae34cdd98..d72db9e30 (2 commits) https://chromium.googlesource.com/chromium/src/tools/win.git/+log/ae34cdd9867c..d72db9e30405 Created with: roll-dep tools/win Change-Id: I018519985e92700765211d1a6878e7ea3a3a254f Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/162790 Reviewed-by: Tom Sepez Auto-Submit: Lei Zhang Commit-Queue: Lei Zhang Commit-Queue: Tom Sepez --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index 682ba902f..172ed450e 100644 --- a/DEPS +++ b/DEPS @@ -264,7 +264,7 @@ vars = { # Three lines of non-changing comments so that # the commit queue can handle CLs rolling tools_win_revision # and whatever else without interference from each other. - 'tools_win_revision': 'ae34cdd9867c5d2b185fadc9d4a9cc82bb741760', + 'tools_win_revision': 'd72db9e3040567a7589e00c0ad7ddf25c3b070bc', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling v8 # and whatever else without interference from each other. From f7878a86a13ecebd52b80d6f580cacd076a93c31 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Mon, 2 Nov 2026 10:44:47 -0800 Subject: [PATCH 06/14] Roll third_party/icu/ 5aa526207..a0ea93436 (9 commits) https://chromium.googlesource.com/chromium/deps/icu.git/+log/5aa526207171..a0ea93436c52 Created with: roll-dep third_party/icu Change-Id: I8a9414acbc581ebe23fd6e737062a588ab1492b7 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/162791 Commit-Queue: Tom Sepez Commit-Queue: Lei Zhang Auto-Submit: Lei Zhang Reviewed-by: Tom Sepez --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index 172ed450e..1637a637d 100644 --- a/DEPS +++ b/DEPS @@ -166,7 +166,7 @@ vars = { # Three lines of non-changing comments so that # the commit queue can handle CLs rolling icu # and whatever else without interference from each other. - 'icu_revision': '5aa526207171ecadf31597f0980a7b7ad8872f33', + 'icu_revision': 'a0ea93436c528ca316a6e698e483e258839101a5', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling instrumented_lib # and whatever else without interference from each other. From b75764a1def138ff0f308c637865f195774ccdc4 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Mon, 2 Nov 2026 11:28:39 -0800 Subject: [PATCH 07/14] Roll third_party/fast_float/src/ b0ab987b3..42f254836 (15 commits) https://chromium.googlesource.com/external/github.com/fastfloat/fast_float.git/+log/b0ab987b3dfd..42f254836ee4 Created with: roll-dep third_party/fast_float/src Change-Id: I7ea08f7e6a13ffc4252ffa5e36da8885f98acfad Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/162751 Auto-Submit: Lei Zhang Reviewed-by: Tom Sepez Commit-Queue: Tom Sepez Commit-Queue: Lei Zhang --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index 1637a637d..dc0f63f78 100644 --- a/DEPS +++ b/DEPS @@ -134,7 +134,7 @@ vars = { # Three lines of non-changing comments so that # the commit queue can handle CLs rolling fast_float # and whatever else without interference from each other. - 'fast_float_revision': 'b0ab987b3dfdde13fa1915f65ef2a5c068d9208c', + 'fast_float_revision': '42f254836ee416ffcf2f4e6576260003ac33d48c', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling fp16 # and whatever else without interference from each other. From 38ee50754c65c85ef1cc3868e8768b7ed4303df9 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Mon, 2 Nov 2026 11:29:33 -0800 Subject: [PATCH 08/14] Roll third_party/googletest/src/ 4fe3307fb..0b6564954 (7 commits) https://chromium.googlesource.com/external/github.com/google/googletest.git/+log/4fe3307fb2d9..0b656495436f Created with: roll-dep third_party/googletest/src Change-Id: I28ebf45fb0f7f71d2f3b01f0570ee741ab640305 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/162770 Auto-Submit: Lei Zhang Reviewed-by: Tom Sepez Commit-Queue: Lei Zhang --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index dc0f63f78..72dd207d7 100644 --- a/DEPS +++ b/DEPS @@ -154,7 +154,7 @@ vars = { # Three lines of non-changing comments so that # the commit queue can handle CLs rolling gtest # and whatever else without interference from each other. - 'gtest_revision': '4fe3307fb2d9f86d19777c7eb0e4809e9694dde7', + 'gtest_revision': '0b656495436f57212be8700794a3d5fb14000c5f', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling HarfBuzz # and whatever else without interference from each other. From 04d4d5c8af604434edb688072438f3eaa44516d5 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Mon, 2 Nov 2026 11:32:35 -0800 Subject: [PATCH 09/14] Roll third_party/skia/ 0abfcf118..607de4b03 (139 commits; 15 trivial rolls) https://skia.googlesource.com/skia.git/+log/0abfcf118530..607de4b035dc Created with: roll-dep third_party/skia Change-Id: I37907bf68345a8bc457b48d56765370c246c3d53 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/162810 Commit-Queue: Lei Zhang Reviewed-by: Tom Sepez --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index 72dd207d7..d1c09267e 100644 --- a/DEPS +++ b/DEPS @@ -244,7 +244,7 @@ vars = { # Three lines of non-changing comments so that # the commit queue can handle CLs rolling skia # and whatever else without interference from each other. - 'skia_revision': '0abfcf118530e0e46e7e466f6d028041af61581a', + 'skia_revision': '607de4b035dcf7fdbaafb66c6cc04f22009ff4d4', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling test_fonts # and whatever else without interference from each other. From 9185ccc21bbe6d0f6176e47c8d2062387483e990 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Mon, 2 Nov 2026 13:08:57 -0800 Subject: [PATCH 10/14] Roll v8/ 0d546234e..bb54fc4e8 (1107 commits) https://chromium.googlesource.com/v8/v8.git/+log/0d546234ecf0..bb54fc4e853a Version 15.9.42 Explicitly set GN v8_enable_ecma402_icu4x = false to avoid an unconditional dependency on Rust for an unused feature. Created with: roll-dep v8 Change-Id: Ie28b457b4fe180157616bcc4188aede97b2da260 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/162830 Reviewed-by: Tom Sepez Commit-Queue: Lei Zhang --- .gn | 3 +++ DEPS | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.gn b/.gn index 33179129c..874f695a8 100644 --- a/.gn +++ b/.gn @@ -35,6 +35,9 @@ default_args = { # PDFium does not include the temporal_rs library. v8_enable_temporal_support = false + # PDFium does not use ICU4X implementations for ECMA-402 features. + v8_enable_ecma402_icu4x = false + # PDFium has its own unsafe-buffers enforcement directories. clang_unsafe_buffers_paths = "//unsafe_buffers_paths.txt" diff --git a/DEPS b/DEPS index d1c09267e..506d7c223 100644 --- a/DEPS +++ b/DEPS @@ -268,7 +268,7 @@ vars = { # Three lines of non-changing comments so that # the commit queue can handle CLs rolling v8 # and whatever else without interference from each other. - 'v8_revision': '0d546234ecf0af2032e958300ef8aeb14bc716c9', + 'v8_revision': 'bb54fc4e853a1ef1640b160e5e854d0a3b514e29', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling zlib # and whatever else without interference from each other. From 55a435dce3f4969356d8875f590561983521a1b4 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Mon, 2 Nov 2026 13:53:50 -0800 Subject: [PATCH 11/14] Roll third_party/llvm-libc/src/ 14e51fd2c..d8f204500 (184 commits) https://chromium.googlesource.com/external/github.com/llvm/llvm-project/libc.git/+log/14e51fd2cd7e..d8f2045008e2 Created with: roll-dep third_party/llvm-libc/src Change-Id: I34f0d023ab44adc2f57c74d2a0635e31472f19bb Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/162930 Reviewed-by: Andy Phan Commit-Queue: Andy Phan Auto-Submit: Lei Zhang --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index 506d7c223..1d0314ab3 100644 --- a/DEPS +++ b/DEPS @@ -204,7 +204,7 @@ vars = { # Three lines of non-changing comments so that # the commit queue can handle CLs rolling llvm-libc # and whatever else without interference from each other. - 'llvm_libc_revision': '14e51fd2cd7ec21294f18a3a0b2fc5339afea271', + 'llvm_libc_revision': 'd8f2045008e230f3c5f50095d918c11f1997e477', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling markupsafe # and whatever else without interference from each other. From 7e01bafbd2f8311a0b3fcbc0371a06a7c2444cd3 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Mon, 2 Nov 2026 14:12:56 -0800 Subject: [PATCH 12/14] Rename bTransMask to is_transparency_mask in CPDF_ColorSpace Follow Google C++ style by eliminating Hungarian notation prefix and using snake_case for the boolean parameter. Also update the comments to clarify that transparency masks are only valid for CMYK colorspaces and not the specific non-CMYK color space. No functional change. Change-Id: I5676029bbbebd50f893d72c2510fb47b83863e74 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/162950 Commit-Queue: Lei Zhang Auto-Submit: Tom Sepez Reviewed-by: Lei Zhang Commit-Queue: Tom Sepez --- core/fpdfapi/page/cpdf_colorspace.cpp | 35 ++++++++++--------- core/fpdfapi/page/cpdf_colorspace.h | 2 +- .../fpdfapi/page/cpdf_colorspace_unittest.cpp | 8 ++--- core/fpdfapi/page/cpdf_devicecs.cpp | 10 +++--- core/fpdfapi/page/cpdf_devicecs.h | 2 +- 5 files changed, 31 insertions(+), 26 deletions(-) diff --git a/core/fpdfapi/page/cpdf_colorspace.cpp b/core/fpdfapi/page/cpdf_colorspace.cpp index 92754d2da..62ad96483 100644 --- a/core/fpdfapi/page/cpdf_colorspace.cpp +++ b/core/fpdfapi/page/cpdf_colorspace.cpp @@ -135,7 +135,7 @@ class CPDF_CalGray final : public CPDF_ColorSpace { int pixels, int image_width, int image_height, - bool bTransMask) const override; + bool is_transparency_mask) const override; private: static constexpr float kDefaultGamma = 1.0f; @@ -160,7 +160,7 @@ class CPDF_CalRGB final : public CPDF_ColorSpace { int pixels, int image_width, int image_height, - bool bTransMask) const override; + bool is_transparency_mask) const override; uint32_t v_Load(CPDF_Document* doc, const CPDF_Array* pArray, std::set* pVisited) override; @@ -194,7 +194,7 @@ class CPDF_LabCS final : public CPDF_ColorSpace { int pixels, int image_width, int image_height, - bool bTransMask) const override; + bool is_transparency_mask) const override; uint32_t v_Load(CPDF_Document* doc, const CPDF_Array* pArray, std::set* pVisited) override; @@ -223,7 +223,7 @@ class CPDF_ICCBasedCS final : public CPDF_BasedCS { int pixels, int image_width, int image_height, - bool bTransMask) const override; + bool is_transparency_mask) const override; bool IsNormal() const override; uint32_t v_Load(CPDF_Document* doc, const CPDF_Array* pArray, @@ -638,10 +638,9 @@ void CPDF_ColorSpace::TranslateImageLine(pdfium::span dest_span, int pixels, int image_width, int image_height, - bool bTransMask) const { - // Only applies to CMYK colorspaces. None of the colorspaces that use this - // generic base implementation are CMYK. - CHECK(!bTransMask); + bool is_transparency_mask) const { + // Transparency masks are only used with CMYK colorspaces, not base CS. + CHECK(!is_transparency_mask); uint8_t* dest_buf = dest_span.data(); const uint8_t* src_buf = src_span.data(); @@ -727,8 +726,9 @@ void CPDF_CalGray::TranslateImageLine(pdfium::span dest_span, int pixels, int image_width, int image_height, - bool bTransMask) const { - CHECK(!bTransMask); // Only applies to CMYK colorspaces. + bool is_transparency_mask) const { + // Transparency masks are only used with CMYK colorspaces, not CalGray. + CHECK(!is_transparency_mask); auto gray_span = src_span.first(static_cast(pixels)); auto rgb_span = fxcrt::reinterpret_span>(dest_span); @@ -810,8 +810,9 @@ void CPDF_CalRGB::TranslateImageLine(pdfium::span dest_span, int pixels, int image_width, int image_height, - bool bTransMask) const { - CHECK(!bTransMask); // Only applies to CMYK colorspaces. + bool is_transparency_mask) const { + // Transparency masks are only used with CMYK colorspaces, not CalRGB. + CHECK(!is_transparency_mask); fxcodec::ReverseRGB(dest_span, src_span, pixels); } @@ -901,8 +902,9 @@ void CPDF_LabCS::TranslateImageLine(pdfium::span dest_span, int pixels, int image_width, int image_height, - bool bTransMask) const { - CHECK(!bTransMask); // Only applies to CMYK colorspaces. + bool is_transparency_mask) const { + // Transparency masks are only used with CMYK colorspaces, not Lab. + CHECK(!is_transparency_mask); auto bgr_span = fxcrt::reinterpret_span>(dest_span); auto lab_span = @@ -993,8 +995,9 @@ void CPDF_ICCBasedCS::TranslateImageLine(pdfium::span dest_span, int pixels, int image_width, int image_height, - bool bTransMask) const { - CHECK(!bTransMask); // Only applies to CMYK colorspaces. + bool is_transparency_mask) const { + // Transparency masks are only used with CMYK colorspaces, not ICCBased. + CHECK(!is_transparency_mask); if (profile_->IsSRGB()) { fxcodec::ReverseRGB(dest_span, src_span, pixels); diff --git a/core/fpdfapi/page/cpdf_colorspace.h b/core/fpdfapi/page/cpdf_colorspace.h index 58214125d..bc16c0afa 100644 --- a/core/fpdfapi/page/cpdf_colorspace.h +++ b/core/fpdfapi/page/cpdf_colorspace.h @@ -123,7 +123,7 @@ class CPDF_ColorSpace : public Retainable, public Observable { int pixels, int image_width, int image_height, - bool bTransMask) const; + bool is_transparency_mask) const; virtual void EnableStdConversion(bool bEnabled); virtual bool IsNormal() const; diff --git a/core/fpdfapi/page/cpdf_colorspace_unittest.cpp b/core/fpdfapi/page/cpdf_colorspace_unittest.cpp index 63b81544b..fe298bf58 100644 --- a/core/fpdfapi/page/cpdf_colorspace_unittest.cpp +++ b/core/fpdfapi/page/cpdf_colorspace_unittest.cpp @@ -22,8 +22,8 @@ TEST(CPDFCalGrayTest, TranslateImageLine) { const uint8_t kSrc[12] = {255, 0, 0, 0, 255, 0, 0, 0, 255, 128, 128, 128}; uint8_t dst[12]; std::ranges::fill(dst, 0xbd); - // `bTransMask` only applies to CYMK colorspaces. - pCal->TranslateImageLine(dst, kSrc, 4, 4, 1, /*bTransMask=*/false); + // Transparency masks are only used with CMYK colorspaces, not CalGray. + pCal->TranslateImageLine(dst, kSrc, 4, 4, 1, /*is_transparency_mask=*/false); EXPECT_THAT(dst, ElementsAre(255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0)); } @@ -34,7 +34,7 @@ TEST(CPDFCalRGBTest, TranslateImageLine) { const uint8_t kSrc[12] = {255, 0, 0, 0, 255, 0, 0, 0, 255, 128, 128, 128}; uint8_t dst[12]; std::ranges::fill(dst, 0xbd); - // `bTransMask` only applies to CYMK colorspaces. - pCal->TranslateImageLine(dst, kSrc, 4, 4, 1, /*bTransMask=*/false); + // Transparency masks are only used with CMYK colorspaces, not CalRGB. + pCal->TranslateImageLine(dst, kSrc, 4, 4, 1, /*is_transparency_mask=*/false); EXPECT_THAT(dst, ElementsAre(0, 0, 255, 0, 255, 0, 255, 0, 0, 128, 128, 128)); } diff --git a/core/fpdfapi/page/cpdf_devicecs.cpp b/core/fpdfapi/page/cpdf_devicecs.cpp index 822c52198..fb0a41648 100644 --- a/core/fpdfapi/page/cpdf_devicecs.cpp +++ b/core/fpdfapi/page/cpdf_devicecs.cpp @@ -83,11 +83,12 @@ void CPDF_DeviceCS::TranslateImageLine(pdfium::span dest_span, int pixels, int image_width, int image_height, - bool bTransMask) const { + bool is_transparency_mask) const { auto rgb_out = fxcrt::reinterpret_span>(dest_span); switch (GetFamily()) { case Family::kDeviceGray: - CHECK(!bTransMask); // bTransMask only allowed for CMYK colorspaces. + // Transparency masks are only used with CMYK colorspaces, not DeviceGray. + CHECK(!is_transparency_mask); // Compiler can't conclude src/dest don't overlap, avoid interleaved // loads and stores by not using an auto& reference here. for (const auto pix : src_span.first(static_cast(pixels))) { @@ -98,13 +99,14 @@ void CPDF_DeviceCS::TranslateImageLine(pdfium::span dest_span, } break; case Family::kDeviceRGB: - CHECK(!bTransMask); // bTransMask only allowed for CMYK colorspaces. + // Transparency masks are only used with CMYK colorspaces, not DeviceRGB. + CHECK(!is_transparency_mask); fxcodec::ReverseRGB(dest_span, src_span, pixels); break; case Family::kDeviceCMYK: { auto cmyk_in = fxcrt::reinterpret_span>(src_span); - if (bTransMask) { + if (is_transparency_mask) { // Compiler can't conclude src/dest don't overlap, avoid interleaved // loads and stores by not using an auto& reference here. for (const auto cmyk : cmyk_in.first(static_cast(pixels))) { diff --git a/core/fpdfapi/page/cpdf_devicecs.h b/core/fpdfapi/page/cpdf_devicecs.h index 5fff876a7..8fb476932 100644 --- a/core/fpdfapi/page/cpdf_devicecs.h +++ b/core/fpdfapi/page/cpdf_devicecs.h @@ -25,7 +25,7 @@ class CPDF_DeviceCS final : public CPDF_ColorSpace { int pixels, int image_width, int image_height, - bool bTransMask) const override; + bool is_transparency_mask) const override; uint32_t v_Load(CPDF_Document* doc, const CPDF_Array* pArray, std::set* pVisited) override; From bbb9926d4de4909ad5dc3dce76607e83589809c6 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Mon, 2 Nov 2026 15:10:15 -0800 Subject: [PATCH 13/14] Reject Pattern color spaces for images in CPDF_DIB ISO 32000-1:2008, section 8.9.5.1, table 89 states that the ColorSpace entry of an image dictionary "can be any type of color space except Pattern". Make CPDF_DIB::LoadColorInfo() fail when the image color space family is CPDF_ColorSpace::Family::kPattern. Previously, an 8 bpc image with a Pattern color space and a default decode array caused CPDF_DIB::TranslateScanline24bppDefaultDecode() to call CPDF_ColorSpace::TranslateImageLine() on a CPDF_PatternCS, which hits the NOTREACHED() in CPDF_PatternCS::GetRGB(). Rejecting the color space up front avoids this, and allows removing the scattered kPattern checks elsewhere in CPDF_DIB that are now dead code. Add an embedder test with an image using [/Pattern /DeviceRGB] that previously crashed on the NOTREACHED(). Fixed: 581053336 Change-Id: I46fd4d9147de92ae06bc6c49e4303db5925fea9a Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/162910 Reviewed-by: Lei Zhang Commit-Queue: Tom Sepez --- core/fpdfapi/page/cpdf_dib.cpp | 12 +++-- .../fpdf_render_pattern_embeddertest.cpp | 9 ++++ testing/resources/image_pattern_colorspace.in | 51 ++++++++++++++++++ .../resources/image_pattern_colorspace.pdf | Bin 0 -> 727 bytes 4 files changed, 68 insertions(+), 4 deletions(-) create mode 100644 testing/resources/image_pattern_colorspace.in create mode 100644 testing/resources/image_pattern_colorspace.pdf diff --git a/core/fpdfapi/page/cpdf_dib.cpp b/core/fpdfapi/page/cpdf_dib.cpp index 60224e2a4..021a22765 100644 --- a/core/fpdfapi/page/cpdf_dib.cpp +++ b/core/fpdfapi/page/cpdf_dib.cpp @@ -389,6 +389,11 @@ bool CPDF_DIB::LoadColorInfo(const CPDF_Dictionary* pFormResources, // decoded. components_ = color_space_->ComponentCount(); family_ = color_space_->GetFamily(); + if (family_ == CPDF_ColorSpace::Family::kPattern) { + // Per ISO 32000-1:2008, section 8.9.5.1, table 89, the ColorSpace entry of + // an image dictionary can be any type of color space except Pattern. + return false; + } if (family_ == CPDF_ColorSpace::Family::kICCBased && pCSObj->IsName()) { ByteString cs = pCSObj->GetString(); if (cs == "DeviceGray") { @@ -879,8 +884,7 @@ CPDF_DIB::LoadState CPDF_DIB::StartLoadMask() { } RetainPtr pMatte = mask->GetDict()->GetArrayFor("Matte"); - if (pMatte && color_space_ && family_ != CPDF_ColorSpace::Family::kPattern && - pMatte->size() == components_ && + if (pMatte && color_space_ && pMatte->size() == components_ && color_space_->ComponentCount() <= components_) { std::vector colors = ReadArrayElementsToVector(pMatte.Get(), components_); @@ -941,7 +945,7 @@ CPDF_DIB::LoadState CPDF_DIB::StartLoadMaskDIB( } void CPDF_DIB::LoadPalette() { - if (!color_space_ || family_ == CPDF_ColorSpace::Family::kPattern) { + if (!color_space_) { return; } @@ -1090,7 +1094,7 @@ void CPDF_DIB::TranslateScanline24bpp( rgb.red = (1.0f - color_values[0]) * k; rgb.green = (1.0f - color_values[1]) * k; rgb.blue = (1.0f - color_values[2]) * k; - } else if (family_ != CPDF_ColorSpace::Family::kPattern) { + } else { rgb = color_space_->GetRGBOrZerosOnError(color_values); } const float R = std::clamp(rgb.red, 0.0f, 1.0f); diff --git a/core/fpdfapi/render/fpdf_render_pattern_embeddertest.cpp b/core/fpdfapi/render/fpdf_render_pattern_embeddertest.cpp index fd69d780a..2c7af39a3 100644 --- a/core/fpdfapi/render/fpdf_render_pattern_embeddertest.cpp +++ b/core/fpdfapi/render/fpdf_render_pattern_embeddertest.cpp @@ -24,3 +24,12 @@ TEST_F(FPDFRenderPatternEmbedderTest, ZeroTilingPatternStep509964646) { ScopedFPDFBitmap bitmap = RenderLoadedPage(page.get()); ASSERT_TRUE(bitmap); } + +TEST_F(FPDFRenderPatternEmbedderTest, ImagePatternColorSpace) { + // Rendering an image with a Pattern color space should not crash. + ASSERT_TRUE(OpenDocument("image_pattern_colorspace.pdf")); + ScopedPage page = LoadScopedPage(0); + ASSERT_TRUE(page); + ScopedFPDFBitmap bitmap = RenderLoadedPage(page.get()); + ASSERT_TRUE(bitmap); +} diff --git a/testing/resources/image_pattern_colorspace.in b/testing/resources/image_pattern_colorspace.in new file mode 100644 index 000000000..8234b2a88 --- /dev/null +++ b/testing/resources/image_pattern_colorspace.in @@ -0,0 +1,51 @@ +{{header}} +{{object 1 0}} << + /Type /Catalog + /Pages 2 0 R +>> +endobj +{{object 2 0}} << + /Type /Pages + /Count 1 + /Kids [3 0 R] +>> +endobj +{{object 3 0}} << + /Type /Page + /Parent 2 0 R + /MediaBox [0 0 100 100] + /Contents 4 0 R + /Resources << + /XObject << + /Im0 5 0 R + >> + >> +>> +endobj +{{object 4 0}} << + {{streamlen}} +>> +stream +q +100 0 0 100 0 0 cm +/Im0 Do +Q +endstream +endobj +{{object 5 0}} << + /Type /XObject + /Subtype /Image + /Width 1 + /Height 1 + /BitsPerComponent 8 + /ColorSpace [/Pattern /DeviceRGB] + {{streamlen}} +>> +stream +abcd +endstream +endobj +{{xref}} +{{trailer}} +{{startxref}} +%%EOF diff --git a/testing/resources/image_pattern_colorspace.pdf b/testing/resources/image_pattern_colorspace.pdf new file mode 100644 index 0000000000000000000000000000000000000000..3be90cccbf1e91023573efe97f5a51d630b58d6e GIT binary patch literal 727 zcmZuvO;5r=5WVlOm^%%Mi4v1qpi zW)YDE?@vXR$&#+xW(HjTy-T7TrXH(jM{)-KlkXa8B>Ao*m3Y7?ksb98Q-@TpW1rcs zPiBakL!Ik0GR9nObx4NoG=#hi=PL}&eox3Cb-*tK05p<)m7{U7(%U^|u~~xWu>0I- zl&N?X>|*bRzhNqD-JTMU98p0m!s2da#a+UMFE%~d&W%ldkW$u+JSP$Lv;p2?5-*D| zJBi6hsJklNsEjjeGP$ePN>4U2M3~ZP8G|~5Y7gI%5XUzin^ZAH{b&d|52JId?;01v zfj~Hi1%dB-J}lsXxikSL=jVYc|d>FSsf(qh+#2UEId8QZzfoXHR#M Wd?H!12O+hwUj4cwDwXSDU;F`QFT0xn literal 0 HcmV?d00001 From 2b52a82ab8170966f08beec1c1bf1aa3d67b6b55 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Mon, 2 Nov 2026 19:33:02 -0800 Subject: [PATCH 14/14] Remove CPDF_ColorSpace::IsStdConversionEnabled() and related code CPDF_ColorSpace::IsStdConversionEnabled() is only checked in CPDF_DeviceCS::GetRGB() and CPDF_DeviceCS::TranslateImageLine() for `Family::kDeviceCMYK`, where it switches from AdobeCmykToStandardRgb() to a simple `1 - min(1, C + K)` formula when `bStdCS` is set to true (e.g. when rendering images with non-normal blend modes or soft masks). This code has two callers: 1. CPDF_DeviceCS::TranslateImageLine() is unreachable because CPDF_DIB resets EnableStdConversion() when image loading finishes, before CPDF_DIB::GetScanline() translates scanlines. 2. CPDF_DeviceCS::GetRGB() is reachable from the bug_557320961 pixel test. However, the rendered output with the IsStdConversionEnabled() code path does not match other PDF renderers, while the else-case does. Remove IsStdConversionEnabled(), EnableStdConversion(), and the associated `bStdCS` / `std_cs_` plumbing across CPDF_ColorSpace, CPDF_BasedCS, CPDF_DeviceCS, CPDF_DIB, CPDF_Image, CPDF_ImageLoader, CPDF_PageImageCache, CPDF_ImageRenderer, and CPDF_RenderStatus. Not only does this simplify the code, but it also makes the rendering more correct. With the code removed, update the bug_557320961 test expectation. This CL is AI generated. Bug: 557320961 Change-Id: I759c4416c963a249533b4ae9c9f4490ebd2d0e25 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/161730 Commit-Queue: Lei Zhang Reviewed-by: Tom Sepez Reviewed-by: Andy Phan --- core/fpdfapi/page/cpdf_basedcs.cpp | 7 ----- core/fpdfapi/page/cpdf_basedcs.h | 2 -- core/fpdfapi/page/cpdf_colorspace.cpp | 8 ----- core/fpdfapi/page/cpdf_colorspace.h | 3 -- core/fpdfapi/page/cpdf_devicecs.cpp | 19 ------------ core/fpdfapi/page/cpdf_dib.cpp | 28 ++---------------- core/fpdfapi/page/cpdf_dib.h | 3 -- core/fpdfapi/page/cpdf_image.cpp | 5 ++-- core/fpdfapi/page/cpdf_image.h | 1 - core/fpdfapi/page/cpdf_imageloader.cpp | 8 ++--- core/fpdfapi/page/cpdf_imageloader.h | 1 - core/fpdfapi/page/cpdf_pageimagecache.cpp | 6 ++-- core/fpdfapi/page/cpdf_pageimagecache.h | 2 -- .../page/cpdf_pageimagecache_unittest.cpp | 12 ++++---- core/fpdfapi/render/cpdf_imagerenderer.cpp | 18 ++++------- core/fpdfapi/render/cpdf_imagerenderer.h | 8 ++--- core/fpdfapi/render/cpdf_renderstatus.cpp | 9 ++---- core/fpdfapi/render/cpdf_renderstatus.h | 2 -- fpdfsdk/fpdf_editimg.cpp | 5 ++-- fpdfsdk/fpdf_thumbnail.cpp | 2 +- .../pixel/bug_557320961_expected.pdf.0.png | Bin 150 -> 151 bytes 21 files changed, 28 insertions(+), 121 deletions(-) diff --git a/core/fpdfapi/page/cpdf_basedcs.cpp b/core/fpdfapi/page/cpdf_basedcs.cpp index 522b1ef8f..f67dbefaa 100644 --- a/core/fpdfapi/page/cpdf_basedcs.cpp +++ b/core/fpdfapi/page/cpdf_basedcs.cpp @@ -9,10 +9,3 @@ CPDF_BasedCS::CPDF_BasedCS(Family family) : CPDF_ColorSpace(family) {} CPDF_BasedCS::~CPDF_BasedCS() = default; - -void CPDF_BasedCS::EnableStdConversion(bool bEnabled) { - CPDF_ColorSpace::EnableStdConversion(bEnabled); - if (base_cs_) { - base_cs_->EnableStdConversion(bEnabled); - } -} diff --git a/core/fpdfapi/page/cpdf_basedcs.h b/core/fpdfapi/page/cpdf_basedcs.h index 55a16ad86..83746a189 100644 --- a/core/fpdfapi/page/cpdf_basedcs.h +++ b/core/fpdfapi/page/cpdf_basedcs.h @@ -18,8 +18,6 @@ class CPDF_BasedCS : public CPDF_ColorSpace { CONSTRUCT_VIA_MAKE_RETAIN; ~CPDF_BasedCS() override; - void EnableStdConversion(bool bEnabled) final; - protected: explicit CPDF_BasedCS(Family family); diff --git a/core/fpdfapi/page/cpdf_colorspace.cpp b/core/fpdfapi/page/cpdf_colorspace.cpp index 62ad96483..f1c83fc9c 100644 --- a/core/fpdfapi/page/cpdf_colorspace.cpp +++ b/core/fpdfapi/page/cpdf_colorspace.cpp @@ -659,14 +659,6 @@ void CPDF_ColorSpace::TranslateImageLine(pdfium::span dest_span, }); } -void CPDF_ColorSpace::EnableStdConversion(bool bEnabled) { - if (bEnabled) { - std_conversion_++; - } else if (std_conversion_) { - std_conversion_--; - } -} - bool CPDF_ColorSpace::IsNormal() const { return GetFamily() == Family::kDeviceGray || GetFamily() == Family::kDeviceRGB || diff --git a/core/fpdfapi/page/cpdf_colorspace.h b/core/fpdfapi/page/cpdf_colorspace.h index bc16c0afa..ade815734 100644 --- a/core/fpdfapi/page/cpdf_colorspace.h +++ b/core/fpdfapi/page/cpdf_colorspace.h @@ -124,7 +124,6 @@ class CPDF_ColorSpace : public Retainable, public Observable { int image_width, int image_height, bool is_transparency_mask) const; - virtual void EnableStdConversion(bool bEnabled); virtual bool IsNormal() const; // Returns `this` as a CPDF_PatternCS* if `this` is a pattern. @@ -146,7 +145,6 @@ class CPDF_ColorSpace : public Retainable, public Observable { // components count. void SetComponentsForStockCS(uint32_t nComponents); - bool IsStdConversionEnabled() const { return std_conversion_ != 0; } bool HasSameArray(const CPDF_Object* pObj) const { return array_ == pObj; } private: @@ -157,7 +155,6 @@ class CPDF_ColorSpace : public Retainable, public Observable { ByteStringView bsFamilyName); const Family family_; - uint32_t std_conversion_ = 0; uint32_t components_ = 0; RetainPtr array_; }; diff --git a/core/fpdfapi/page/cpdf_devicecs.cpp b/core/fpdfapi/page/cpdf_devicecs.cpp index fb0a41648..03a1bbaef 100644 --- a/core/fpdfapi/page/cpdf_devicecs.cpp +++ b/core/fpdfapi/page/cpdf_devicecs.cpp @@ -62,13 +62,6 @@ std::optional> CPDF_DeviceCS::GetRGB( case Family::kDeviceCMYK: { const auto& cmyk = fxcrt::reinterpret_span>(pBuf).front(); - if (IsStdConversionEnabled()) { - return FX_RGB_STRUCT{ - 1.0f - std::min(1.0f, cmyk.cyan + cmyk.key), - 1.0f - std::min(1.0f, cmyk.magenta + cmyk.key), - 1.0f - std::min(1.0f, cmyk.yellow + cmyk.key), - }; - } return AdobeCmykToStandardRgbF( NormalizeChannel(cmyk.cyan), NormalizeChannel(cmyk.magenta), NormalizeChannel(cmyk.yellow), NormalizeChannel(cmyk.key)); @@ -118,18 +111,6 @@ void CPDF_DeviceCS::TranslateImageLine(pdfium::span dest_span, } break; } - if (IsStdConversionEnabled()) { - // Compiler can't conclude src/dest don't overlap, avoid interleaved - // loads and stores by not using am auto& reference here, - for (const auto cmyk : cmyk_in.first(static_cast(pixels))) { - const uint8_t k = cmyk.key; - rgb_out.front().blue = 255 - std::min(255, cmyk.cyan + k); - rgb_out.front().green = 255 - std::min(255, cmyk.magenta + k); - rgb_out.front().red = 255 - std::min(255, cmyk.yellow + k); - rgb_out = rgb_out.subspan<1u>(); - } - break; - } for (const auto& cmyk : cmyk_in.first(static_cast(pixels))) { // TODO(tsepez): maybe this is a FX_BGR_STRUCT in reality? FX_RGB_STRUCT rgb = AdobeCmykToStandardRgb( diff --git a/core/fpdfapi/page/cpdf_dib.cpp b/core/fpdfapi/page/cpdf_dib.cpp index 021a22765..792862dec 100644 --- a/core/fpdfapi/page/cpdf_dib.cpp +++ b/core/fpdfapi/page/cpdf_dib.cpp @@ -162,14 +162,6 @@ bool CPDF_DIB::Load() { return ContinueInternal(); } -bool CPDF_DIB::ContinueToLoadMask() { - if (color_space_ && std_cs_) { - color_space_->EnableStdConversion(true); - } - - return ContinueInternal(); -} - bool CPDF_DIB::ContinueInternal() { if (image_mask_) { SetMaskProperties(); @@ -213,11 +205,9 @@ CPDF_DIB::LoadState CPDF_DIB::StartLoadDIBBase( bool bHasMask, const CPDF_Dictionary* pFormResources, const CPDF_Dictionary* pPageResources, - bool bStdCS, CPDF_ColorSpace::Family GroupFamily, bool bLoadMask, const CFX_Size& max_size_required) { - std_cs_ = bStdCS; has_mask_ = bHasMask; group_family_ = GroupFamily; load_mask_ = bLoadMask; @@ -242,7 +232,7 @@ CPDF_DIB::LoadState CPDF_DIB::StartLoadDIBBase( return LoadState::kFail; } - if (!ContinueToLoadMask()) { + if (!ContinueInternal()) { return LoadState::kFail; } @@ -254,9 +244,6 @@ CPDF_DIB::LoadState CPDF_DIB::StartLoadDIBBase( DCHECK_EQ(iCreatedDecoder, LoadState::kSuccess); DCHECK_EQ(iLoadedMask, LoadState::kSuccess); - if (color_space_ && std_cs_) { - color_space_->EnableStdConversion(false); - } return LoadState::kSuccess; } @@ -328,13 +315,6 @@ CPDF_DIB::LoadState CPDF_DIB::ContinueLoadDIBBase(PauseIndicatorIface* pPause) { status_ = LoadState::kContinue; } } - if (iContinueStatus == LoadState::kContinue) { - return LoadState::kContinue; - } - - if (color_space_ && std_cs_) { - color_space_->EnableStdConversion(false); - } return iContinueStatus; } @@ -907,10 +887,6 @@ CPDF_DIB::LoadState CPDF_DIB::ContinueLoadMaskDIB(PauseIndicatorIface* pPause) { return LoadState::kContinue; } - if (color_space_ && std_cs_) { - color_space_->EnableStdConversion(false); - } - if (ret == LoadState::kFail) { mask_.Reset(); return LoadState::kFail; @@ -930,7 +906,7 @@ CPDF_DIB::LoadState CPDF_DIB::StartLoadMaskDIB( RetainPtr mask_stream) { mask_ = pdfium::MakeRetain(document_, std::move(mask_stream)); LoadState ret = - mask_->StartLoadDIBBase(false, nullptr, nullptr, true, + mask_->StartLoadDIBBase(false, nullptr, nullptr, CPDF_ColorSpace::Family::kUnknown, false, {0, 0}); if (ret == LoadState::kContinue) { if (status_ == LoadState::kFail) { diff --git a/core/fpdfapi/page/cpdf_dib.h b/core/fpdfapi/page/cpdf_dib.h index 737da040f..2b6b69ca6 100644 --- a/core/fpdfapi/page/cpdf_dib.h +++ b/core/fpdfapi/page/cpdf_dib.h @@ -60,7 +60,6 @@ class CPDF_DIB final : public CFX_DIBBase { LoadState StartLoadDIBBase(bool bHasMask, const CPDF_Dictionary* pFormResources, const CPDF_Dictionary* pPageResources, - bool bStdCS, CPDF_ColorSpace::Family GroupFamily, bool bLoadMask, const CFX_Size& max_size_required); @@ -85,7 +84,6 @@ class CPDF_DIB final : public CFX_DIBBase { bool ContinueInternal(); LoadState StartLoadMask(); LoadState StartLoadMaskDIB(RetainPtr mask_stream); - bool ContinueToLoadMask(); LoadState ContinueLoadMaskDIB(PauseIndicatorIface* pPause); bool LoadColorInfo(const CPDF_Dictionary* pFormResources, const CPDF_Dictionary* pPageResources); @@ -137,7 +135,6 @@ class CPDF_DIB final : public CFX_DIBBase { bool do_bpc_check_ = true; bool color_key_ = false; bool has_mask_ = false; - bool std_cs_ = false; std::vector comp_data_; mutable DataVector line_buf_; mutable DataVector mask_buf_; diff --git a/core/fpdfapi/page/cpdf_image.cpp b/core/fpdfapi/page/cpdf_image.cpp index 534284b79..bcc169229 100644 --- a/core/fpdfapi/page/cpdf_image.cpp +++ b/core/fpdfapi/page/cpdf_image.cpp @@ -361,14 +361,13 @@ RetainPtr CPDF_Image::DetachMask() { bool CPDF_Image::StartLoadDIBBase(const CPDF_Dictionary* pFormResource, const CPDF_Dictionary* pPageResource, - bool bStdCS, CPDF_ColorSpace::Family GroupFamily, bool bLoadMask, const CFX_Size& max_size_required) { RetainPtr source = CreateNewDIB(); CPDF_DIB::LoadState ret = - source->StartLoadDIBBase(true, pFormResource, pPageResource, bStdCS, - GroupFamily, bLoadMask, max_size_required); + source->StartLoadDIBBase(true, pFormResource, pPageResource, GroupFamily, + bLoadMask, max_size_required); if (ret == CPDF_DIB::LoadState::kFail) { dibbase_.Reset(); return false; diff --git a/core/fpdfapi/page/cpdf_image.h b/core/fpdfapi/page/cpdf_image.h index 175cfc162..1022a9775 100644 --- a/core/fpdfapi/page/cpdf_image.h +++ b/core/fpdfapi/page/cpdf_image.h @@ -63,7 +63,6 @@ class CPDF_Image final : public Retainable { // Returns whether to Continue() or not. bool StartLoadDIBBase(const CPDF_Dictionary* pFormResource, const CPDF_Dictionary* pPageResource, - bool bStdCS, CPDF_ColorSpace::Family GroupFamily, bool bLoadMask, const CFX_Size& max_size_required); diff --git a/core/fpdfapi/page/cpdf_imageloader.cpp b/core/fpdfapi/page/cpdf_imageloader.cpp index a8387d9f9..c043d25ed 100644 --- a/core/fpdfapi/page/cpdf_imageloader.cpp +++ b/core/fpdfapi/page/cpdf_imageloader.cpp @@ -24,7 +24,6 @@ bool CPDF_ImageLoader::Start(const CPDF_ImageObject* pImage, CPDF_PageImageCache* pPageImageCache, const CPDF_Dictionary* pFormResource, const CPDF_Dictionary* pPageResource, - bool bStdCS, CPDF_ColorSpace::Family eFamily, bool bLoadMask, const CFX_Size& max_size_required) { @@ -33,12 +32,11 @@ bool CPDF_ImageLoader::Start(const CPDF_ImageObject* pImage, bool should_continue; if (cache_) { should_continue = cache_->StartGetCachedBitmap( - image_object_->GetImage(), pFormResource, pPageResource, bStdCS, - eFamily, bLoadMask, max_size_required); + image_object_->GetImage(), pFormResource, pPageResource, eFamily, + bLoadMask, max_size_required); } else { should_continue = image_object_->GetImage()->StartLoadDIBBase( - pFormResource, pPageResource, bStdCS, eFamily, bLoadMask, - max_size_required); + pFormResource, pPageResource, eFamily, bLoadMask, max_size_required); } if (!should_continue) { Finish(); diff --git a/core/fpdfapi/page/cpdf_imageloader.h b/core/fpdfapi/page/cpdf_imageloader.h index 50eb0cefd..bd49c3a42 100644 --- a/core/fpdfapi/page/cpdf_imageloader.h +++ b/core/fpdfapi/page/cpdf_imageloader.h @@ -27,7 +27,6 @@ class CPDF_ImageLoader { CPDF_PageImageCache* pPageImageCache, const CPDF_Dictionary* pFormResource, const CPDF_Dictionary* pPageResource, - bool bStdCS, CPDF_ColorSpace::Family eFamily, bool bLoadMask, const CFX_Size& max_size_required); diff --git a/core/fpdfapi/page/cpdf_pageimagecache.cpp b/core/fpdfapi/page/cpdf_pageimagecache.cpp index 565be4e74..08fc9fd94 100644 --- a/core/fpdfapi/page/cpdf_pageimagecache.cpp +++ b/core/fpdfapi/page/cpdf_pageimagecache.cpp @@ -170,7 +170,6 @@ bool CPDF_PageImageCache::StartGetCachedBitmap( RetainPtr pImage, const CPDF_Dictionary* pFormResources, const CPDF_Dictionary* pPageResources, - bool bStdCS, CPDF_ColorSpace::Family eFamily, bool bLoadMask, const CFX_Size& max_size_required) { @@ -188,7 +187,7 @@ bool CPDF_PageImageCache::StartGetCachedBitmap( cur_image_cache_entry_ = std::make_unique(std::move(pImage)); } CPDF_DIB::LoadState ret = cur_image_cache_entry_->StartGetCachedBitmap( - this, pFormResources, pPageResources, bStdCS, eFamily, bLoadMask, + this, pFormResources, pPageResources, eFamily, bLoadMask, max_size_required); if (ret == CPDF_DIB::LoadState::kContinue) { return true; @@ -268,7 +267,6 @@ CPDF_DIB::LoadState CPDF_PageImageCache::Entry::StartGetCachedBitmap( CPDF_PageImageCache* pPageImageCache, const CPDF_Dictionary* pFormResources, const CPDF_Dictionary* pPageResources, - bool bStdCS, CPDF_ColorSpace::Family eFamily, bool bLoadMask, const CFX_Size& max_size_required) { @@ -280,7 +278,7 @@ CPDF_DIB::LoadState CPDF_PageImageCache::Entry::StartGetCachedBitmap( cur_bitmap_ = image_->CreateNewDIB(); CPDF_DIB::LoadState ret = cur_bitmap_.AsRaw()->StartLoadDIBBase( - true, pFormResources, pPageResources, bStdCS, eFamily, bLoadMask, + true, pFormResources, pPageResources, eFamily, bLoadMask, max_size_required); cached_set_max_size_required_ = (max_size_required.width != 0 && max_size_required.height != 0); diff --git a/core/fpdfapi/page/cpdf_pageimagecache.h b/core/fpdfapi/page/cpdf_pageimagecache.h index eb06742f9..027e53f14 100644 --- a/core/fpdfapi/page/cpdf_pageimagecache.h +++ b/core/fpdfapi/page/cpdf_pageimagecache.h @@ -37,7 +37,6 @@ class CPDF_PageImageCache { bool StartGetCachedBitmap(RetainPtr pImage, const CPDF_Dictionary* pFormResources, const CPDF_Dictionary* pPageResources, - bool bStdCS, CPDF_ColorSpace::Family eFamily, bool bLoadMask, const CFX_Size& max_size_required); @@ -65,7 +64,6 @@ class CPDF_PageImageCache { CPDF_PageImageCache* pPageImageCache, const CPDF_Dictionary* pFormResources, const CPDF_Dictionary* pPageResources, - bool bStdCS, CPDF_ColorSpace::Family eFamily, bool bLoadMask, const CFX_Size& max_size_required); diff --git a/core/fpdfapi/page/cpdf_pageimagecache_unittest.cpp b/core/fpdfapi/page/cpdf_pageimagecache_unittest.cpp index c266a2201..f7f4e9cac 100644 --- a/core/fpdfapi/page/cpdf_pageimagecache_unittest.cpp +++ b/core/fpdfapi/page/cpdf_pageimagecache_unittest.cpp @@ -58,7 +58,7 @@ TEST_F(CPDFPageImageCacheTest, RenderBug1924) { // Render with small scale. bool should_continue = page_image_cache->StartGetCachedBitmap( - image->GetImage(), nullptr, page->GetMutablePageResources(), true, + image->GetImage(), nullptr, page->GetMutablePageResources(), CPDF_ColorSpace::Family::kICCBased, false, {50, 50}); while (should_continue) { should_continue = page_image_cache->Continue(nullptr); @@ -68,7 +68,7 @@ TEST_F(CPDFPageImageCacheTest, RenderBug1924) { // And render with large scale. should_continue = page_image_cache->StartGetCachedBitmap( - image->GetImage(), nullptr, page->GetMutablePageResources(), true, + image->GetImage(), nullptr, page->GetMutablePageResources(), CPDF_ColorSpace::Family::kICCBased, false, {100, 100}); while (should_continue) { should_continue = page_image_cache->Continue(nullptr); @@ -117,7 +117,7 @@ TEST_F(CPDFPageImageCacheTest, RenderReducedDctThenFullSize) { // Render with small scale: 400/50 -> 1/8, so a 50x50 bitmap. bool should_continue = page_image_cache->StartGetCachedBitmap( - image->GetImage(), nullptr, page->GetMutablePageResources(), true, + image->GetImage(), nullptr, page->GetMutablePageResources(), CPDF_ColorSpace::Family::kUnknown, false, {50, 50}); while (should_continue) { should_continue = page_image_cache->Continue(nullptr); @@ -130,7 +130,7 @@ TEST_F(CPDFPageImageCacheTest, RenderReducedDctThenFullSize) { // Render with large scale: 400/100 -> 1/4, so a 100x100 bitmap. The cached // 50x50 bitmap is too small, so this forces a higher-resolution re-decode. should_continue = page_image_cache->StartGetCachedBitmap( - image->GetImage(), nullptr, page->GetMutablePageResources(), true, + image->GetImage(), nullptr, page->GetMutablePageResources(), CPDF_ColorSpace::Family::kUnknown, false, {100, 100}); while (should_continue) { should_continue = page_image_cache->Continue(nullptr); @@ -178,7 +178,7 @@ TEST_F(CPDFPageImageCacheTest, RenderReducedDctWithSMask) { // Draw small so the 400x400 base is decoded at reduced resolution. bool should_continue = page_image_cache->StartGetCachedBitmap( - image->GetImage(), nullptr, page->GetMutablePageResources(), true, + image->GetImage(), nullptr, page->GetMutablePageResources(), CPDF_ColorSpace::Family::kUnknown, /*bLoadMask=*/true, {50, 50}); while (should_continue) { should_continue = page_image_cache->Continue(nullptr); @@ -236,7 +236,7 @@ TEST_F(CPDFPageImageCacheTest, NonMcuAlignedDctIsNotReduced) { // Draw small: an MCU-aligned image would be reduced here, but this one must // not be, so the decoded bitmap stays at the full 408x408. bool should_continue = page_image_cache->StartGetCachedBitmap( - image->GetImage(), nullptr, page->GetMutablePageResources(), true, + image->GetImage(), nullptr, page->GetMutablePageResources(), CPDF_ColorSpace::Family::kUnknown, false, {50, 50}); while (should_continue) { should_continue = page_image_cache->Continue(nullptr); diff --git a/core/fpdfapi/render/cpdf_imagerenderer.cpp b/core/fpdfapi/render/cpdf_imagerenderer.cpp index 5d1e4fa8f..aa291f04b 100644 --- a/core/fpdfapi/render/cpdf_imagerenderer.cpp +++ b/core/fpdfapi/render/cpdf_imagerenderer.cpp @@ -73,8 +73,7 @@ bool CPDF_ImageRenderer::StartLoadDIBBase() { if (!loader_->Start( image_object_, render_status_->GetContext()->GetPageCache(), render_status_->GetFormResource(), render_status_->GetPageResource(), - std_cs_, render_status_->GetGroupFamily(), - render_status_->GetLoadMask(), + render_status_->GetGroupFamily(), render_status_->GetLoadMask(), {render_status_->GetRenderDevice()->GetWidth(), render_status_->GetRenderDevice()->GetHeight()})) { return false; @@ -186,10 +185,8 @@ bool CPDF_ImageRenderer::StartRenderDIBBase() { } bool CPDF_ImageRenderer::Start(CPDF_ImageObject* pImageObject, - const CFX_Matrix& mtObj2Device, - bool bStdCS) { + const CFX_Matrix& mtObj2Device) { DCHECK(pImageObject); - std_cs_ = bStdCS; image_object_ = pImageObject; blend_type_ = BlendMode::kNormal; obj_to_device_ = mtObj2Device; @@ -209,14 +206,12 @@ bool CPDF_ImageRenderer::Start(CPDF_ImageObject* pImageObject, bool CPDF_ImageRenderer::Start(RetainPtr pDIBBase, FX_ARGB bitmap_argb, const CFX_Matrix& mtImage2Device, - const FXDIB_ResampleOptions& options, - bool bStdCS) { + const FXDIB_ResampleOptions& options) { dibbase_ = std::move(pDIBBase); fill_argb_ = bitmap_argb; alpha_ = 1.0f; image_matrix_ = mtImage2Device; resample_options_ = options; - std_cs_ = bStdCS; blend_type_ = BlendMode::kNormal; return StartDIBBase(); } @@ -281,12 +276,11 @@ RetainPtr CPDF_ImageRenderer::CalculateDrawImage( CPDF_RenderStatus mask_status(render_status_->GetContext(), mask_device.get()); mask_status.SetDropObjects(render_status_->GetDropObjects()); - mask_status.SetStdCS(true); mask_status.Initialize(nullptr, nullptr); CPDF_ImageRenderer mask_renderer(&mask_status); if (mask_renderer.Start(std::move(pDIBBase), 0xffffffff, mtNewMatrix, - resample_options_, true)) { + resample_options_)) { mask_renderer.Continue(nullptr); } if (loader_->MatteColor() != 0xffffffff) { @@ -349,7 +343,6 @@ bool CPDF_ImageRenderer::DrawPatternImage() { bitmap_device.get()); bitmap_status.SetOptions(GetRenderOptions()); bitmap_status.SetDropObjects(render_status_->GetDropObjects()); - bitmap_status.SetStdCS(true); bitmap_status.Initialize(nullptr, nullptr); CFX_Matrix pattern_matrix = obj_to_device_; @@ -404,10 +397,9 @@ bool CPDF_ImageRenderer::DrawMaskedImage() { CPDF_RenderStatus bitmap_status(render_status_->GetContext(), bitmap_device.get()); bitmap_status.SetDropObjects(render_status_->GetDropObjects()); - bitmap_status.SetStdCS(true); bitmap_status.Initialize(nullptr, nullptr); CPDF_ImageRenderer bitmap_renderer(&bitmap_status); - if (bitmap_renderer.Start(dibbase_, 0, new_matrix, resample_options_, true)) { + if (bitmap_renderer.Start(dibbase_, 0, new_matrix, resample_options_)) { bitmap_renderer.Continue(nullptr); } RetainPtr mask_bitmap = CalculateDrawImage( diff --git a/core/fpdfapi/render/cpdf_imagerenderer.h b/core/fpdfapi/render/cpdf_imagerenderer.h index 610f20f68..d3784aa9c 100644 --- a/core/fpdfapi/render/cpdf_imagerenderer.h +++ b/core/fpdfapi/render/cpdf_imagerenderer.h @@ -36,15 +36,12 @@ class CPDF_ImageRenderer { explicit CPDF_ImageRenderer(CPDF_RenderStatus* pStatus); ~CPDF_ImageRenderer(); - bool Start(CPDF_ImageObject* pImageObject, - const CFX_Matrix& mtObj2Device, - bool bStdCS); + bool Start(CPDF_ImageObject* pImageObject, const CFX_Matrix& mtObj2Device); bool Start(RetainPtr pDIBBase, FX_ARGB bitmap_argb, const CFX_Matrix& mtImage2Device, - const FXDIB_ResampleOptions& options, - bool bStdCS); + const FXDIB_ResampleOptions& options); bool Continue(PauseIndicatorIface* pPause); bool GetResult() const { return result_; } @@ -106,7 +103,6 @@ class CPDF_ImageRenderer { FX_ARGB fill_argb_ = 0; FXDIB_ResampleOptions resample_options_; bool pattern_color_ = false; - bool std_cs_ = false; bool result_ = true; }; diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp index 8f596f5a4..728f0e16b 100644 --- a/core/fpdfapi/render/cpdf_renderstatus.cpp +++ b/core/fpdfapi/render/cpdf_renderstatus.cpp @@ -284,8 +284,7 @@ bool CPDF_RenderStatus::ContinueSingleObject(CPDF_PageObject* pObj, } image_renderer_ = std::make_unique(this); - if (!image_renderer_->Start(pObj->AsImage(), mtObj2Device, - /*bStdCS=*/false)) { + if (!image_renderer_->Start(pObj->AsImage(), mtObj2Device)) { if (!image_renderer_->GetResult()) { DrawObjWithBackground(pObj, mtObj2Device); } @@ -720,7 +719,6 @@ bool CPDF_RenderStatus::ProcessTransparency(CPDF_PageObject* pPageObj, CPDF_RenderStatus bitmap_render(context_, bitmap_device.get()); bitmap_render.SetOptions(options_); bitmap_render.SetStopObject(stop_obj_); - bitmap_render.SetStdCS(true); bitmap_render.SetDropObjects(drop_objects_); bitmap_render.SetFormResource(std::move(pFormResource)); bitmap_render.SetInGroup(transparency.IsGroup()); @@ -1056,7 +1054,7 @@ bool CPDF_RenderStatus::ProcessType3Text(CPDF_TextObject* textobj, CFX_Matrix image_matrix = pType3Char->matrix() * matrix; CPDF_ImageRenderer renderer(this); if (renderer.Start(pType3Char->GetBitmap(), fill_argb, image_matrix, - FXDIB_ResampleOptions(), false)) { + FXDIB_ResampleOptions())) { renderer.Continue(nullptr); } if (!renderer.GetResult()) { @@ -1299,7 +1297,7 @@ void CPDF_RenderStatus::ProcessPathPattern( bool CPDF_RenderStatus::ProcessImage(CPDF_ImageObject* pImageObj, const CFX_Matrix& mtObj2Device) { CPDF_ImageRenderer render(this); - if (render.Start(pImageObj, mtObj2Device, std_cs_)) { + if (render.Start(pImageObj, mtObj2Device)) { render.Continue(nullptr); } return render.GetResult(); @@ -1489,7 +1487,6 @@ RetainPtr CPDF_RenderStatus::LoadSMask( status.SetOptions(options); status.SetGroupFamily(nCSFamily); status.SetLoadMask(bLuminosity); - status.SetStdCS(true); status.SetFormResource(std::move(pFormResource)); status.SetDropObjects(drop_objects_); status.Initialize(nullptr, nullptr); diff --git a/core/fpdfapi/render/cpdf_renderstatus.h b/core/fpdfapi/render/cpdf_renderstatus.h index b002aa312..9050264fa 100644 --- a/core/fpdfapi/render/cpdf_renderstatus.h +++ b/core/fpdfapi/render/cpdf_renderstatus.h @@ -59,7 +59,6 @@ class CPDF_RenderStatus { void SetFillColor(FX_ARGB color) { t3_fill_color_ = color; } void SetDropObjects(bool bDropObjects) { drop_objects_ = bDropObjects; } void SetLoadMask(bool bLoadMask) { load_mask_ = bLoadMask; } - void SetStdCS(bool bStdCS) { std_cs_ = bStdCS; } void SetGroupFamily(CPDF_ColorSpace::Family family) { group_family_ = family; } @@ -210,7 +209,6 @@ class CPDF_RenderStatus { bool print_ = false; #endif bool drop_objects_ = false; - bool std_cs_ = false; bool load_mask_ = false; bool in_group_ = false; CPDF_ColorSpace::Family group_family_ = CPDF_ColorSpace::Family::kUnknown; diff --git a/fpdfsdk/fpdf_editimg.cpp b/fpdfsdk/fpdf_editimg.cpp index 9bdc1e1b5..958c5ceaf 100644 --- a/fpdfsdk/fpdf_editimg.cpp +++ b/fpdfsdk/fpdf_editimg.cpp @@ -359,8 +359,7 @@ FPDFImageObj_GetRenderedBitmap(FPDF_DOCUMENT document, } // Do the actual rendering. - bool should_continue = - renderer.Start(image, image_render_matrix, /*bStdCS=*/false); + bool should_continue = renderer.Start(image, image_render_matrix); while (should_continue) { should_continue = renderer.Continue(/*pPause=*/nullptr); } @@ -527,7 +526,7 @@ FPDFImageObj_GetImageMetadata(FPDF_PAGEOBJECT image_object, RetainPtr pSource = pImg->CreateNewDIB(); CPDF_DIB::LoadState ret = pSource->StartLoadDIBBase( - false, nullptr, pPage->GetPageResources().Get(), false, + false, nullptr, pPage->GetPageResources().Get(), CPDF_ColorSpace::Family::kUnknown, false, {0, 0}); if (ret == CPDF_DIB::LoadState::kFail) { return true; diff --git a/fpdfsdk/fpdf_thumbnail.cpp b/fpdfsdk/fpdf_thumbnail.cpp index 18fe04909..97ec3e7c1 100644 --- a/fpdfsdk/fpdf_thumbnail.cpp +++ b/fpdfsdk/fpdf_thumbnail.cpp @@ -81,7 +81,7 @@ FPDFPage_GetThumbnailAsBitmap(FPDF_PAGE page) { auto dib_source = pdfium::MakeRetain(pdf_page->GetDocument(), std::move(thumb_stream)); const CPDF_DIB::LoadState start_status = dib_source->StartLoadDIBBase( - false, nullptr, pdf_page->GetPageResources().Get(), false, + false, nullptr, pdf_page->GetPageResources().Get(), CPDF_ColorSpace::Family::kUnknown, false, {0, 0}); if (start_status == CPDF_DIB::LoadState::kFail) { return nullptr; diff --git a/testing/resources/pixel/bug_557320961_expected.pdf.0.png b/testing/resources/pixel/bug_557320961_expected.pdf.0.png index 397ef476c6230c5d1152aa27da866268683ae9f5..8850e8975e7358fbb3ada98cc2f2351435d698d1 100644 GIT binary patch delta 116 zcmV-)0E_>Y0ha-gDs8UsBOf5`0*wFh0ssI1vF}HZ0000(NklJO=IwM L^>bP0l+XkKuzD>7