From 8ac9c246829265099f34fd7a474a7e74ee22a9a1 Mon Sep 17 00:00:00 2001 From: "pdfium-autoroll@skia-public.iam.gserviceaccount.com" Date: Sun, 29 Nov 2026 20:35:07 -0800 Subject: [PATCH 01/15] Roll Catapult from c29dedc30c9f to a93a68f704ca (44 revisions) https://chromium.googlesource.com/catapult.git/+log/c29dedc30c9f..a93a68f704ca 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: I197e667250b57d18ee3ad8709e4306046ead3e52 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/165710 Commit-Queue: pdfium-autoroll@skia-public.iam.gserviceaccount.com Bot-Commit: pdfium-autoroll@skia-public.iam.gserviceaccount.com --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index a37659b2f..778b00aa9 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': 'c29dedc30c9ff1b0cc677e32a9a959ad5ed41bde', + 'catapult_revision': 'a93a68f704ca422b2c5e8fd2f4fe36397b71c270', # 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 c8f2471eaae61c0aad3c553b831e380b8072fb04 Mon Sep 17 00:00:00 2001 From: "pdfium-autoroll@skia-public.iam.gserviceaccount.com" Date: Sun, 29 Nov 2026 20:50:49 -0800 Subject: [PATCH 02/15] Roll Zlib from 9f9f52c60a14 to 02826dbec8ef (5 revisions) https://chromium.googlesource.com/chromium/src/third_party/zlib.git/+log/9f9f52c60a14..02826dbec8ef 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: I711830c6ea65afc56aa22200b184e4034a929c0b Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/165690 Commit-Queue: pdfium-autoroll@skia-public.iam.gserviceaccount.com Bot-Commit: pdfium-autoroll@skia-public.iam.gserviceaccount.com --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index 778b00aa9..53e3a4998 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': '9f9f52c60a14e8e772fb561029ae0a121fef7609', + 'zlib_revision': '02826dbec8efeccfcd8960142c75fd704f0ddd03', } # Only these hosts are allowed for dependencies in this DEPS file. From ff89dc832cb66e900b32252cb5d40c05e8fc2bfd Mon Sep 17 00:00:00 2001 From: deepak1556 Date: Mon, 30 Nov 2026 14:02:22 -0800 Subject: [PATCH 03/15] Roll v8/ b5156d2a7..a12d1e566 (991 commits) https://chromium.googlesource.com/v8/v8.git/+log/b5156d2a71b5..a12d1e5662b8 Version 16.0.129 Created with: roll-dep v8 Change-Id: If7ad0f39346faf2c19423a3ecbb9043eee47253c Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/165531 Auto-Submit: Deepak Mohan (Robo) Reviewed-by: Tom Sepez Commit-Queue: Lei Zhang Reviewed-by: Lei Zhang --- .gn | 4 +++- DEPS | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.gn b/.gn index 516519769..f13464945 100644 --- a/.gn +++ b/.gn @@ -42,6 +42,9 @@ default_args = { # PDFium does not use ICU4X implementations for ECMA-402 features. v8_enable_ecma402_icu4x = false + # PDFium does not include the boringssl library. + v8_use_openssl = false + # PDFium has its own unsafe-buffers enforcement directories. clang_unsafe_buffers_paths = "//unsafe_buffers_paths.txt" @@ -72,7 +75,6 @@ no_check_targets = [ "//v8:cppgc_base", "//v8:v8_internal_headers", "//v8/src/inspector:inspector", - "//v8/test/cctest:cctest_sources", "//v8/test/unittests:inspector_unittests_sources", ] diff --git a/DEPS b/DEPS index 53e3a4998..c986187eb 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': 'b5156d2a71b52cab0b53a82a165c77612179098b', + 'v8_revision': 'a12d1e5662b89c58b5cca490fc4a770051f0567e', # 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 60207438dbb15b4fbc6ad4310b4ccba35191c443 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Mon, 30 Nov 2026 15:12:35 -0800 Subject: [PATCH 04/15] Out-of-cycle roll to update cppgc plugin with new warnings. Roll build/ 0c62137b8..25b83e4e2 (260 commits; 1 trivial rolls) https://chromium.googlesource.com/chromium/src/build.git/+log/0c62137b8623..25b83e4e2722 Roll tools/clang/ 7ea1bdeea..1692d7278 (25 commits) https://chromium.googlesource.com/chromium/src/tools/clang/+log/7ea1bdeeaf49..1692d7278beb Roll tools/rust/ b7b03f53f..49993f7c2 (8 commits) https://chromium.googlesource.com/chromium/src/tools/rust/+log/b7b03f53f..49993f7c2 Roll third_party/nasm/ 525a09a81..54b1dcf79 (2 commits) https://chromium.googlesource.com/chromium/deps/nasm.git/+log/525a09a81..54b1dcf79 -- Avoid new "-Wunreachable-code-return" in third_party/cpu_features Created with: roll-dep build roll-dep tools/clang roll-dep tools/rust roll-dep nasm roll_downstream_gcs_deps.py \ --source-deps ~/repo/chrome/src/DEPS \ --destination-deps DEPS \ --source-package src/third_party/llvm-build/Release+Asserts \ --destination-package third_party/llvm-build/Release+Asserts roll_downstream_gcs_deps.py \ --source-deps ~/repo/chrome/src/DEPS \ --destination-deps DEPS \ --source-package src/third_party/llvm-libclang \ --destination-package third_party/llvm-libclang roll_downstream_gcs_deps.py \ --source-deps ~/repo/chrome/src/DEPS \ --destination-deps DEPS \ --source-package src/third_party/rust-toolchain \ --destination-package third_party/rust-toolchain Change-Id: I573306cc494eb36fec78f6fd0cfeccff0919141d Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/165570 Reviewed-by: Lei Zhang Commit-Queue: Tom Sepez --- DEPS | 264 +++++++++++++++--------------- third_party/cpu_features/BUILD.gn | 9 +- 2 files changed, 140 insertions(+), 133 deletions(-) diff --git a/DEPS b/DEPS index c986187eb..1ee5a68c9 100644 --- a/DEPS +++ b/DEPS @@ -94,7 +94,7 @@ vars = { # Three lines of non-changing comments so that # the commit queue can handle CLs rolling build # and whatever else without interference from each other. - 'build_revision': '0c62137b8623a3fab2c6aa5d7c94f719b3aa31f6', + 'build_revision': '25b83e4e27227b1121cf83fd1cd89a7c81a59afd', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling buildtools # and whatever else without interference from each other. @@ -110,7 +110,7 @@ vars = { # Three lines of non-changing comments so that # the commit queue can handle CLs rolling clang # and whatever else without interference from each other. - 'clang_revision': '7ea1bdeeaf498a513c77b66667e56f6f41f9f0b3', + 'clang_revision': '1692d7278beb9a529be6e860f5f029cc37d0ca83', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling code_coverage # and whatever else without interference from each other. @@ -212,7 +212,7 @@ vars = { # Three lines of non-changing comments so that # the commit queue can handle CLs rolling nasm_source # and whatever else without interference from each other. - 'nasm_source_revision': '525a09a813be0f75b646ee93fc2a31c27b87d722', + 'nasm_source_revision': '54b1dcf7995006337c54f6862fd6f77a01e23e4e', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling Ninja CIPD package version # and whatever else without interference from each other. @@ -260,7 +260,7 @@ vars = { # Three lines of non-changing comments so that # the commit queue can handle CLs rolling tools_rust # and whatever else without interference from each other. - 'tools_rust_revision': 'b7b03f53fe7d9e6b781bd1837d92275279ce5794', + 'tools_rust_revision': '49993f7c20c21400fd1d390cbf72994d7b63df17', # 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. @@ -489,171 +489,171 @@ deps = { 'bucket': 'chromium-browser-clang', 'objects': [ { - 'object_name': 'Linux_x64/clang-android-runtime-library-llvmorg-24-init-14453-ge063be79-1.tar.xz', - 'sha256sum': 'dd03492cad72f223d7743c2f4af39c405f5bac7f7f342de09697a45b7108ce4e', - 'size_bytes': 6188284, - 'generation': 1792086693754706, + 'object_name': 'Linux_x64/clang-android-runtime-library-llvmorg-24-init-22088-g7ba4f04e-2.tar.xz', + 'sha256sum': '9c475b960e85fc775208cb37fa419a015d4aed32a3ccb50f2fefd433259e8ac2', + 'size_bytes': 6204692, + 'generation': 1795570298808568, 'condition': 'checkout_android and non_git_source', }, { - 'object_name': 'Linux_x64/clang-linux-runtime-library-llvmorg-24-init-14453-ge063be79-1.tar.xz', - 'sha256sum': '38338f434311fcd12a070757c23830d6076529f4dcbefebc9d094804dc4eca63', - 'size_bytes': 3145380, - 'generation': 1792086698521278, + 'object_name': 'Linux_x64/clang-linux-runtime-library-llvmorg-24-init-22088-g7ba4f04e-2.tar.xz', + 'sha256sum': 'f2259d1723da32cb15b85278bd404dffb9144871432586e45b25f80e8983b837', + 'size_bytes': 3161016, + 'generation': 1795570303202888, 'condition': 'checkout_linux and not host_os == "linux"', }, { - 'object_name': 'Linux_x64/clang-llvmorg-24-init-14453-ge063be79-1.tar.xz', - 'sha256sum': '0b76afc1a29b0583f7723e966b9b65a22b15d8fdcd38e7c567ae32343c68944d', - 'size_bytes': 58394648, - 'generation': 1792086691304470, + 'object_name': 'Linux_x64/clang-llvmorg-24-init-22088-g7ba4f04e-2.tar.xz', + 'sha256sum': '572c7e605f8c85c47a657906e56476b257140cb66543c7ec30afdd24ba5d0592', + 'size_bytes': 59668136, + 'generation': 1795570296342061, 'condition': 'host_os == "linux" and non_git_source', }, { - 'object_name': 'Linux_x64/clang-tidy-llvmorg-24-init-14453-ge063be79-1.tar.xz', - 'sha256sum': 'cf2a7610086b45fb878f606709babd3cbd8e26ea97a087ea47929e4ee871b562', - 'size_bytes': 15213064, - 'generation': 1792086691338093, + 'object_name': 'Linux_x64/clang-tidy-llvmorg-24-init-22088-g7ba4f04e-2.tar.xz', + 'sha256sum': '494e9b091d6d28cc6c10eba876e5d988a28b2f0341fc93d251f97d77a29f979a', + 'size_bytes': 15399668, + 'generation': 1795570296279632, 'condition': 'host_os == "linux" and checkout_clang_tidy and non_git_source', }, { - 'object_name': 'Linux_x64/clangd-llvmorg-24-init-14453-ge063be79-1.tar.xz', - 'sha256sum': '5ef64ed6fdeab8dfd91f11db07c601ce5107fc9e61e9d7a18dcee97af42f03c6', - 'size_bytes': 15595776, - 'generation': 1792086691391942, + 'object_name': 'Linux_x64/clangd-llvmorg-24-init-22088-g7ba4f04e-2.tar.xz', + 'sha256sum': '46be8a77fd48ee64e8cac0b56f77d8c04a866b672b6179d1f183d7a061767952', + 'size_bytes': 15749740, + 'generation': 1795570296337026, 'condition': 'host_os == "linux" and checkout_clangd and non_git_source', }, { - 'object_name': 'Linux_x64/llvm-code-coverage-llvmorg-24-init-14453-ge063be79-1.tar.xz', - 'sha256sum': '756e08684179166571dd155471e0a9c4525223d30b45d776b3d75a4d53b820d3', - 'size_bytes': 2432768, - 'generation': 1792086691721951, + 'object_name': 'Linux_x64/llvm-code-coverage-llvmorg-24-init-22088-g7ba4f04e-2.tar.xz', + 'sha256sum': '3862e232dd53a8d6d04e77807997dea1e7c8766974a47950c937a33d706086ac', + 'size_bytes': 2451628, + 'generation': 1795570296570605, 'condition': 'host_os == "linux" and checkout_clang_coverage_tools and non_git_source', }, { - 'object_name': 'Linux_x64/llvmobjdump-llvmorg-24-init-14453-ge063be79-1.tar.xz', - 'sha256sum': '2282c8a4bdc6e12242989525039a36e7eeb4335b22d39d3b5d624c38083881c5', - 'size_bytes': 6011380, - 'generation': 1792086691439732, + 'object_name': 'Linux_x64/llvmobjdump-llvmorg-24-init-22088-g7ba4f04e-2.tar.xz', + 'sha256sum': '8b96f5a40ddf4bad9409d31ce92277f817043ce8540afce57f37f3cc5fa0386c', + 'size_bytes': 6057980, + 'generation': 1795570296427865, 'condition': '((checkout_linux or checkout_mac or checkout_ios or checkout_android) and host_os == "linux") and non_git_source', }, { - 'object_name': 'Mac/clang-llvmorg-24-init-14453-ge063be79-1.tar.xz', - 'sha256sum': 'ae29ec360eda6e80e96f8638d368ecdeea93d19c18c527c525dc0932bd5243a4', - 'size_bytes': 54834700, - 'generation': 1792086700293656, + 'object_name': 'Mac/clang-llvmorg-24-init-22088-g7ba4f04e-2.tar.xz', + 'sha256sum': '8143ec86e7a8186aaa791d0803acc3f6ec48de5b1032c586ca26220596e0bf7e', + 'size_bytes': 55622340, + 'generation': 1795570304841461, 'condition': 'host_os == "mac" and host_cpu == "x64"', }, { - 'object_name': 'Mac/clang-mac-runtime-library-llvmorg-24-init-14453-ge063be79-1.tar.xz', - 'sha256sum': 'c18444eef64cf27a8913ce73ffa8fd92e6f41306a02bbc82d805aa0c521863e0', - 'size_bytes': 997164, - 'generation': 1792086707123823, + 'object_name': 'Mac/clang-mac-runtime-library-llvmorg-24-init-22088-g7ba4f04e-2.tar.xz', + 'sha256sum': '5e156e2323d4e7ae045b1aad492a2841bf3290c7e6f6cda1ca1dd997e03631d9', + 'size_bytes': 1282632, + 'generation': 1795570311599234, 'condition': '(checkout_mac or checkout_ios) and not host_os == "mac" and non_git_source', }, { - 'object_name': 'Mac/clang-tidy-llvmorg-24-init-14453-ge063be79-1.tar.xz', - 'sha256sum': '3997f34e72dc28eb30af1b8af903ceb6b0f516db7821996297bf296793addc72', - 'size_bytes': 14437076, - 'generation': 1792086700400707, + 'object_name': 'Mac/clang-tidy-llvmorg-24-init-22088-g7ba4f04e-2.tar.xz', + 'sha256sum': '46b6ff4f23fbf52cebddf6f97f258c66370483feaa41600e5107bc5c603503a7', + 'size_bytes': 14541444, + 'generation': 1795570304829931, 'condition': 'host_os == "mac" and host_cpu == "x64" and checkout_clang_tidy', }, { - 'object_name': 'Mac/clangd-llvmorg-24-init-14453-ge063be79-1.tar.xz', - 'sha256sum': '0fc9c351ad3bc6c357cc53a57dad6f8ebf45ba9e38150012cb457812f2a1314f', - 'size_bytes': 15359244, - 'generation': 1792086700318835, + 'object_name': 'Mac/clangd-llvmorg-24-init-22088-g7ba4f04e-2.tar.xz', + 'sha256sum': '901be912b7d4edc0e962730ac50113d4ae0bbb9f7cd8550a6fe80df465032849', + 'size_bytes': 15630772, + 'generation': 1795570304813308, 'condition': 'host_os == "mac" and host_cpu == "x64" and checkout_clangd', }, { - 'object_name': 'Mac/llvm-code-coverage-llvmorg-24-init-14453-ge063be79-1.tar.xz', - 'sha256sum': 'b8b2f099cb029ff36cce33c9983984f547d7da0d9c34c1b427bb1080a31b8047', - 'size_bytes': 2307268, - 'generation': 1792086700464636, + 'object_name': 'Mac/llvm-code-coverage-llvmorg-24-init-22088-g7ba4f04e-2.tar.xz', + 'sha256sum': '51daf34442661f4c8e59990ee084657b4b6eb19d470f8477b3ccb6d1de0d4986', + 'size_bytes': 2324516, + 'generation': 1795570304958967, 'condition': 'host_os == "mac" and host_cpu == "x64" and checkout_clang_coverage_tools', }, { - 'object_name': 'Mac/llvmobjdump-llvmorg-24-init-14453-ge063be79-1.tar.xz', - 'sha256sum': 'eae7800773f3955fd1dcc334d8779b9a232ca6ebd3a79a55be028bd8797b1197', - 'size_bytes': 5586688, - 'generation': 1792086700364844, + 'object_name': 'Mac/llvmobjdump-llvmorg-24-init-22088-g7ba4f04e-2.tar.xz', + 'sha256sum': '2356202c1e848bc5828b2ad92e321bc047eedd43c3e3cbae2b2b4228e8642276', + 'size_bytes': 5627732, + 'generation': 1795570304868447, 'condition': 'host_os == "mac" and host_cpu == "x64"', }, { - 'object_name': 'Mac_arm64/clang-llvmorg-24-init-14453-ge063be79-1.tar.xz', - 'sha256sum': '0a8d887534b3153c7f6860265dc7e075d420174521c60ccd52c2c243949ef468', - 'size_bytes': 44917408, - 'generation': 1792086708845653, + 'object_name': 'Mac_arm64/clang-llvmorg-24-init-22088-g7ba4f04e-2.tar.xz', + 'sha256sum': 'd6b45fe77088ec639eab724044de3136ebd66114172fc6a99316404e3a2813fa', + 'size_bytes': 45679856, + 'generation': 1795570313160951, 'condition': 'host_os == "mac" and host_cpu == "arm64"', }, { - 'object_name': 'Mac_arm64/clang-tidy-llvmorg-24-init-14453-ge063be79-1.tar.xz', - 'sha256sum': '1aee3a0078bbe3b840125f521d3e6d985de61531ee6686a0bef80abc6e6d6a78', - 'size_bytes': 12291060, - 'generation': 1792086708806950, + 'object_name': 'Mac_arm64/clang-tidy-llvmorg-24-init-22088-g7ba4f04e-2.tar.xz', + 'sha256sum': '82088f04fa3d28b3e7ef9c670d2fbfb819c8e871ae472acf22b20d21e4ea89f5', + 'size_bytes': 12427476, + 'generation': 1795570313180770, 'condition': 'host_os == "mac" and host_cpu == "arm64" and checkout_clang_tidy', }, { - 'object_name': 'Mac_arm64/clangd-llvmorg-24-init-14453-ge063be79-1.tar.xz', - 'sha256sum': '799e034e1fdff7eb7d899329ab20bbeb96642234844c9e070797059bd6ce5ee9', - 'size_bytes': 12292508, - 'generation': 1792086709015693, + 'object_name': 'Mac_arm64/clangd-llvmorg-24-init-22088-g7ba4f04e-2.tar.xz', + 'sha256sum': 'a74a70404a093d4e57d96190e39d60d1491c2b55a7a8e893ce9f08b0a968ef67', + 'size_bytes': 12421400, + 'generation': 1795570313176417, 'condition': 'host_os == "mac" and host_cpu == "arm64" and checkout_clangd', }, { - 'object_name': 'Mac_arm64/llvm-code-coverage-llvmorg-24-init-14453-ge063be79-1.tar.xz', - 'sha256sum': 'a77bacfb3e6c08af7d51981d88fb4aa07e4fb797f37937071dd8657b7c2dea8e', - 'size_bytes': 1897140, - 'generation': 1792086709049271, + 'object_name': 'Mac_arm64/llvm-code-coverage-llvmorg-24-init-22088-g7ba4f04e-2.tar.xz', + 'sha256sum': '8be59d32483d306579218d4204da964d4d9374fa93f5d73a26f491b3807d04b7', + 'size_bytes': 1909220, + 'generation': 1795570313318955, 'condition': 'host_os == "mac" and host_cpu == "arm64" and checkout_clang_coverage_tools', }, { - 'object_name': 'Mac_arm64/llvmobjdump-llvmorg-24-init-14453-ge063be79-1.tar.xz', - 'sha256sum': '8d15119ffd7e9d52e86676bfdcfd8159506f0ba6c4b292ae4112cbf15e629d7d', - 'size_bytes': 5269524, - 'generation': 1792086709009144, + 'object_name': 'Mac_arm64/llvmobjdump-llvmorg-24-init-22088-g7ba4f04e-2.tar.xz', + 'sha256sum': '724566d7e4d4c26a205cb0acfa784f253eec22a71ee360b970bd97ca25533277', + 'size_bytes': 5310916, + 'generation': 1795570313233488, 'condition': 'host_os == "mac" and host_cpu == "arm64"', }, { - 'object_name': 'Win/clang-llvmorg-24-init-14453-ge063be79-1.tar.xz', - 'sha256sum': '08abce6e1d01c2fff9b25a09e36d9976296f27842196f96411b8220364481818', - 'size_bytes': 52783904, - 'generation': 1792086718487613, + 'object_name': 'Win/clang-llvmorg-24-init-22088-g7ba4f04e-2.tar.xz', + 'sha256sum': '160fb5eec6942c257f85015062a12e4685f061abe5af8e47bcbb1d280f036c47', + 'size_bytes': 53521076, + 'generation': 1795570321847777, 'condition': 'host_os == "win"', }, { - 'object_name': 'Win/clang-tidy-llvmorg-24-init-14453-ge063be79-1.tar.xz', - 'sha256sum': 'ee25e107e6da91254780b0e9b6fb34198dc03636330c5564a7786e6450916d45', - 'size_bytes': 15436080, - 'generation': 1792086718412245, + 'object_name': 'Win/clang-tidy-llvmorg-24-init-22088-g7ba4f04e-2.tar.xz', + 'sha256sum': 'a0c70bc1d917ecc4f975f75ef3296a21f51b09aa6935447116d929d208883021', + 'size_bytes': 15640204, + 'generation': 1795570321881942, 'condition': 'host_os == "win" and checkout_clang_tidy', }, { - 'object_name': 'Win/clang-win-runtime-library-llvmorg-24-init-14453-ge063be79-1.tar.xz', - 'sha256sum': 'a156f6fa1f149e45faa683f2b2d1cc010df1e29912b3cb0a0dd3e3d9186c513b', - 'size_bytes': 2707764, - 'generation': 1792086725161419, + 'object_name': 'Win/clang-win-runtime-library-llvmorg-24-init-22088-g7ba4f04e-2.tar.xz', + 'sha256sum': '9c3b4fa88296fcfef6d73144b8b96070272b92aaadc2cc36f7ac43456a174a15', + 'size_bytes': 2722764, + 'generation': 1795570328823736, 'condition': 'checkout_win and not host_os == "win"', }, { - 'object_name': 'Win/clangd-llvmorg-24-init-14453-ge063be79-1.tar.xz', - 'sha256sum': '0db39ead1a1f49137570fd5e99ab7520262c2e6444900b551862ae2cccdf6bb8', - 'size_bytes': 15910376, - 'generation': 1792086718402867, + 'object_name': 'Win/clangd-llvmorg-24-init-22088-g7ba4f04e-2.tar.xz', + 'sha256sum': '1d8f7b74f12e521114417c05f8483305bc1e880104fe60f672ffded10248b869', + 'size_bytes': 16104300, + 'generation': 1795570321914165, 'condition': 'host_os == "win" and checkout_clangd', }, { - 'object_name': 'Win/llvm-code-coverage-llvmorg-24-init-14453-ge063be79-1.tar.xz', - 'sha256sum': '3cfd8304148bd6bdd86a99f4e5f01ea2b4fbcbf4f35e29a2ca3cb235cb88c393', - 'size_bytes': 2604364, - 'generation': 1792086718581883, + 'object_name': 'Win/llvm-code-coverage-llvmorg-24-init-22088-g7ba4f04e-2.tar.xz', + 'sha256sum': '0a96cffbd7fefa6d6c50d4f4719e61f9bc96acc58b611ffd8c166783a995fd36', + 'size_bytes': 2623096, + 'generation': 1795570322088115, 'condition': 'host_os == "win" and checkout_clang_coverage_tools', }, { - 'object_name': 'Win/llvmobjdump-llvmorg-24-init-14453-ge063be79-1.tar.xz', - 'sha256sum': '3b58242027a9e86114d05444e9e70a9ed497a6a9e9c14d1b86c355e140503a53', - 'size_bytes': 6123208, - 'generation': 1792086718463583, + 'object_name': 'Win/llvmobjdump-llvmorg-24-init-22088-g7ba4f04e-2.tar.xz', + 'sha256sum': 'f39d5d31c6573cc907d151d4a4e6bc75bf61aed547930ded4cbf09897f33ecb9', + 'size_bytes': 6167812, + 'generation': 1795570321986134, 'condition': '(checkout_linux or checkout_mac or checkout_android) and host_os == "win"', }, ] @@ -668,31 +668,31 @@ deps = { 'bucket': 'chromium-browser-clang', 'objects': [ { - 'object_name': 'Linux_x64/rust-libclang-8a9dd7abdf013ec10cfeaaa3685feba18ef1c90c-6-llvmorg-24-init-14453-ge063be79.tar.xz', - 'sha256sum': '693fd176a27508efb6cbc06b7db9c64abfc19497664dbaf4a9f4d489b8b4239a', - 'size_bytes': 23021680, - 'generation': 1793195408791425, + 'object_name': 'Linux_x64/rust-libclang-277240238554297f93fa9ee3c7643dfa03ccbbb4-2-llvmorg-24-init-22088-g7ba4f04e.tar.xz', + 'sha256sum': '57c9f59097f7f237def35069e287012b45930e0b442e9840276397bca0e9e1aa', + 'size_bytes': 23140276, + 'generation': 1795540677107040, 'condition': 'host_os == "linux" and non_git_source', }, { - 'object_name': 'Mac/rust-libclang-8a9dd7abdf013ec10cfeaaa3685feba18ef1c90c-6-llvmorg-24-init-14453-ge063be79.tar.xz', - 'sha256sum': 'b08bf161b5acaba2fe39d9a8089f8134417bfaef33531b6e4e84365e7c828bfe', - 'size_bytes': 23159048, - 'generation': 1793195412269519, + 'object_name': 'Mac/rust-libclang-277240238554297f93fa9ee3c7643dfa03ccbbb4-2-llvmorg-24-init-22088-g7ba4f04e.tar.xz', + 'sha256sum': '015c1c87fb877ec0e6c5aafeaf5006c7db39e1f5a2c94d00ff11a1bce4329ef3', + 'size_bytes': 23295240, + 'generation': 1795540680254981, 'condition': 'host_os == "mac" and host_cpu == "x64"', }, { - 'object_name': 'Mac_arm64/rust-libclang-8a9dd7abdf013ec10cfeaaa3685feba18ef1c90c-6-llvmorg-24-init-14453-ge063be79.tar.xz', - 'sha256sum': 'aa01ed55d80721dc53acf6fb604113037ba5142f3668ce7f7a02427b787cfea5', - 'size_bytes': 20842496, - 'generation': 1793195415799242, + 'object_name': 'Mac_arm64/rust-libclang-277240238554297f93fa9ee3c7643dfa03ccbbb4-2-llvmorg-24-init-22088-g7ba4f04e.tar.xz', + 'sha256sum': '419463cf0583db39137fef5ba444494515191c8e45dd3ec85e87e3e1a7f051db', + 'size_bytes': 20940708, + 'generation': 1795540683406566, 'condition': 'host_os == "mac" and host_cpu == "arm64"', }, { - 'object_name': 'Win/rust-libclang-8a9dd7abdf013ec10cfeaaa3685feba18ef1c90c-6-llvmorg-24-init-14453-ge063be79.tar.xz', - 'sha256sum': '38438c49085b1770020713fc981bf63a6e7d6398d8c1d7f094ec509347d384e8', - 'size_bytes': 21764276, - 'generation': 1793195419458813, + 'object_name': 'Win/rust-libclang-277240238554297f93fa9ee3c7643dfa03ccbbb4-2-llvmorg-24-init-22088-g7ba4f04e.tar.xz', + 'sha256sum': 'f68d9d19d5926a36a67244549ba24c9d35ac3cd00bc199caa00367a651407c60', + 'size_bytes': 21857176, + 'generation': 1795540686608947, 'condition': 'host_os == "win"', }, ], @@ -731,31 +731,31 @@ deps = { 'bucket': 'chromium-browser-clang', 'objects': [ { - 'object_name': 'Linux_x64/rust-toolchain-8a9dd7abdf013ec10cfeaaa3685feba18ef1c90c-6-llvmorg-24-init-14453-ge063be79.tar.xz', - 'sha256sum': '4b4f64d5e82e845099b6ff63c61df311f8202183f1996ca247e20db6d9cda29c', - 'size_bytes': 287835700, - 'generation': 1793195406905214, + 'object_name': 'Linux_x64/rust-toolchain-277240238554297f93fa9ee3c7643dfa03ccbbb4-2-llvmorg-24-init-22088-g7ba4f04e.tar.xz', + 'sha256sum': '31332199efdde339e5d402f82257650a8706944bfc53c7d0b0c545f63e12f25d', + 'size_bytes': 285246336, + 'generation': 1795540675486514, 'condition': 'host_os == "linux" and non_git_source', }, { - 'object_name': 'Mac/rust-toolchain-8a9dd7abdf013ec10cfeaaa3685feba18ef1c90c-6-llvmorg-24-init-14453-ge063be79.tar.xz', - 'sha256sum': '7bd89fb1973d32d0231a1ffcd48851d629986763695c43ba6e8d8182361c538f', - 'size_bytes': 274877668, - 'generation': 1793195410604331, + 'object_name': 'Mac/rust-toolchain-277240238554297f93fa9ee3c7643dfa03ccbbb4-2-llvmorg-24-init-22088-g7ba4f04e.tar.xz', + 'sha256sum': '1355795cf0dceb022d5275d4b8124a3f69c4571937e75450557f8ee4cfd03da5', + 'size_bytes': 273343364, + 'generation': 1795540678702341, 'condition': 'host_os == "mac" and host_cpu == "x64"', }, { - 'object_name': 'Mac_arm64/rust-toolchain-8a9dd7abdf013ec10cfeaaa3685feba18ef1c90c-6-llvmorg-24-init-14453-ge063be79.tar.xz', - 'sha256sum': '7d1680ebf1d9ea133cd34d5f229c8491fbdbf9fe0da24171b686c8ecb8a4cad8', - 'size_bytes': 258546192, - 'generation': 1793195414074050, + 'object_name': 'Mac_arm64/rust-toolchain-277240238554297f93fa9ee3c7643dfa03ccbbb4-2-llvmorg-24-init-22088-g7ba4f04e.tar.xz', + 'sha256sum': '1295e09ef89b8f6ca09fac6a078437675ef81caf3548085e77f0ffd416380b38', + 'size_bytes': 257090228, + 'generation': 1795540681838583, 'condition': 'host_os == "mac" and host_cpu == "arm64"', }, { - 'object_name': 'Win/rust-toolchain-8a9dd7abdf013ec10cfeaaa3685feba18ef1c90c-6-llvmorg-24-init-14453-ge063be79.tar.xz', - 'sha256sum': '9e519f453f7fea971f531b7e4c5a8e686081b9647d7660deb0641efac306840f', - 'size_bytes': 426696244, - 'generation': 1793195417684260, + 'object_name': 'Win/rust-toolchain-277240238554297f93fa9ee3c7643dfa03ccbbb4-2-llvmorg-24-init-22088-g7ba4f04e.tar.xz', + 'sha256sum': '571031deaa091a0e30604b87d0a293465654eee33280e7114edb1bdf1ca1705e', + 'size_bytes': 425873176, + 'generation': 1795540685051205, 'condition': 'host_os == "win"', }, ], diff --git a/third_party/cpu_features/BUILD.gn b/third_party/cpu_features/BUILD.gn index f6fcc3d2b..f89af5ae3 100644 --- a/third_party/cpu_features/BUILD.gn +++ b/third_party/cpu_features/BUILD.gn @@ -3,7 +3,14 @@ # found in the LICENSE file. config("cpu_features_config") { - cflags = [ "-Wno-unused-function" ] + cflags = [ + "-Wno-unused-function", + + # `CpuFeatures_StringView_HasWord()` ends with `return false;` after a + # `for (;;)` loop, which triggers `-Wunreachable-code-return` in C23 mode. + # Remove once https://github.com/google/cpu_features/pull/479 rolls in. + "-Wno-unreachable-code-return", + ] defines = [ "STACK_LINE_READER_BUFFER_SIZE=1024", "HAVE_STRONG_GETAUXVAL", From f1f5b66c6afced2a9973d0874847d5e6b6f5ada2 Mon Sep 17 00:00:00 2001 From: Miyoung Shin Date: Mon, 30 Nov 2026 17:38:25 -0800 Subject: [PATCH 05/15] Roll brotli and include its headers from src/ Chromium moved //third_party/brotli's upstream files into src/ (crrev.com/c/8814220), so the decoder header is now at third_party/brotli/src/c/include/brotli/. Roll the brotli DEPS entry to that revision and include the header from its new path. Chromium keeps a temporary forwarding header at the old path until this change rolls into Chromium. https://chromium.googlesource.com/chromium/src/third_party/brotli.git/+log/803ac7166..ee1fadd36 ee1fadd36 [3p freshness] brotli: Move upstream code into src/ 3b164bb40 Roll brotli to latest HEAD commit Bug: 584095794 Change-Id: Iebf0f53c9d3cdb9efe2f82b46625eaf1baa7c4a2 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/164250 Reviewed-by: Lei Zhang Reviewed-by: Tom Sepez Commit-Queue: Lei Zhang --- DEPS | 2 +- core/fxcodec/brotli/DEPS | 2 +- core/fxcodec/brotli/brotli_decoder.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/DEPS b/DEPS index 1ee5a68c9..afac0c60f 100644 --- a/DEPS +++ b/DEPS @@ -90,7 +90,7 @@ vars = { # Three lines of non-changing comments so that # the commit queue can handle CLs rolling brotli # and whatever else without interference from each other. - 'brotli_revision': '803ac71664ad62af1de39ff55e63ebbe07006fc8', + 'brotli_revision': 'ee1fadd362a24bf226c55606caa6b30f15ee0fa1', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling build # and whatever else without interference from each other. diff --git a/core/fxcodec/brotli/DEPS b/core/fxcodec/brotli/DEPS index 2e514af19..de76ac69b 100644 --- a/core/fxcodec/brotli/DEPS +++ b/core/fxcodec/brotli/DEPS @@ -1,3 +1,3 @@ include_rules = [ - "+third_party/brotli/include/brotli", + "+third_party/brotli/src/c/include/brotli", ] diff --git a/core/fxcodec/brotli/brotli_decoder.cpp b/core/fxcodec/brotli/brotli_decoder.cpp index cc96b58cf..7a5b97996 100644 --- a/core/fxcodec/brotli/brotli_decoder.cpp +++ b/core/fxcodec/brotli/brotli_decoder.cpp @@ -13,7 +13,7 @@ #include "core/fxcrt/data_vector.h" #include "core/fxcrt/fx_extension.h" #include "core/fxcrt/numerics/safe_conversions.h" -#include "third_party/brotli/include/brotli/decode.h" +#include "third_party/brotli/src/c/include/brotli/decode.h" namespace { From 094c22f840f4392012b60c17cf63863b33a0b448 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Tue, 1 Dec 2026 01:16:23 -0800 Subject: [PATCH 06/15] Add CPDFPageContentGeneratorTest.ProcessTextWithUnsupportedType3Font Add a unit test covering CPDF_PageContentGenerator::ProcessText() when given a text object using a Type 3 font. ProcessText() currently writes unclosed "q" and "BT" operators and creates an unused ExtGState resource before returning early for unsupported font types. Demonstrate the current buggy behavior with TODOs to fix it. This CL is AI generated. Change-Id: I21a27a71e89048343077d3306b1f96a545db8d9c Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/164970 Commit-Queue: Lei Zhang Reviewed-by: Andy Phan --- .../cpdf_pagecontentgenerator_unittest.cpp | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp b/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp index 205c7240e..722d662c1 100644 --- a/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp +++ b/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp @@ -459,6 +459,38 @@ TEST_F(CPDFPageContentGeneratorTest, ProcessText) { EXPECT_EQ("Helvetica", font_desc->GetNameFor("FontName")); } +TEST_F(CPDFPageContentGeneratorTest, ProcessTextWithUnsupportedType3Font) { + auto doc = std::make_unique(); + doc->CreateNewDoc(); + + RetainPtr page_dict(doc->CreateNewPage(0)); + auto test_page = pdfium::MakeRetain(doc.get(), page_dict); + + auto font_dict = doc->NewIndirect(); + font_dict->SetNewFor("Type", "Font"); + font_dict->SetNewFor("Subtype", "Type3"); + RetainPtr font = + CPDF_DocPageData::FromDocument(doc.get())->GetFont(font_dict); + ASSERT_TRUE(font); + ASSERT_TRUE(font->IsType3Font()); + + auto text_obj = std::make_unique(); + text_obj->mutable_text_state().SetFont(std::move(font)); + text_obj->mutable_text_state().SetFontSize(12.0f); + text_obj->mutable_general_state().SetFillAlpha(0.5f); + text_obj->Transform(CFX_Matrix(1, 0, 0, 1, 100, 100)); + text_obj->SetText("Type3"); + + CPDF_PageContentGenerator generator(test_page.Get()); + fxcrt::ostringstream buf; + TestProcessText(&generator, &buf, text_obj.get()); + // CPDF_PageContentGenerator does not support Type 3 fonts. + // TODO(thestig): Should be empty string. + EXPECT_EQ("q /FXE1 gs BT 1 0 0 1 100 100 Tm ", ByteString(buf)); + // TODO(thestig): Should be false. + EXPECT_TRUE(test_page->GetResources()); +} + TEST_F(CPDFPageContentGeneratorTest, ProcessEmptyForm) { auto doc = std::make_unique(); doc->CreateNewDoc(); From 728d97050d0cdadb34cffea720257387b042cc76 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Tue, 1 Dec 2026 01:19:50 -0800 Subject: [PATCH 07/15] Check font type before writing operators in ProcessText() CPDF_PageContentGenerator::ProcessText() currently calls ProcessGraphics() and writes "BT" / "Tm" operators before checking whether the font type is supported. When encountering an unsupported font (such as a Type 3 font), the early return leaves unclosed "q" and "BT" operators in the stream and can leave behind an unused ExtGState resource. Move the font lookup and font-type check ahead of ProcessGraphics() so returning early writes nothing to the buffer and creates no resources. Update CPDFPageContentGeneratorTest.ProcessTextWithUnsupportedType3Font expectations accordingly. This CL is AI generated. Change-Id: If251620e85c90cfdcbefcda6a32c37cfc38b9de5 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/164971 Commit-Queue: Lei Zhang Reviewed-by: Andy Phan --- core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp | 16 ++++++++-------- .../edit/cpdf_pagecontentgenerator_unittest.cpp | 6 ++---- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp index 207468f9b..fb97506b4 100644 --- a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp +++ b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp @@ -943,14 +943,6 @@ ByteString CPDF_PageContentGenerator::GetOrCreateDefaultGraphics() const { // TJ sets the actual text, <####...> is used when specifying charcodes. void CPDF_PageContentGenerator::ProcessText(fxcrt::ostringstream* buf, CPDF_TextObject* pTextObj) { - ProcessGraphics(buf, pTextObj); - *buf << "BT "; - - const CFX_Matrix& matrix = pTextObj->GetTextMatrix(); - if (!matrix.IsIdentity()) { - WriteMatrix(*buf, matrix) << " Tm "; - } - RetainPtr font(pTextObj->GetFont()); if (!font) { font = CPDF_Font::GetStockFont(document_, "Helvetica"); @@ -971,6 +963,14 @@ void CPDF_PageContentGenerator::ProcessText(fxcrt::ostringstream* buf, } data.baseFont = font->GetBaseFontName(); + ProcessGraphics(buf, pTextObj); + *buf << "BT "; + + const CFX_Matrix& matrix = pTextObj->GetTextMatrix(); + if (!matrix.IsIdentity()) { + WriteMatrix(*buf, matrix) << " Tm "; + } + ByteString dict_name; std::optional maybe_name = obj_holder_->FontsMapSearch(data); if (maybe_name.has_value()) { diff --git a/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp b/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp index 722d662c1..3f7a7300d 100644 --- a/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp +++ b/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp @@ -485,10 +485,8 @@ TEST_F(CPDFPageContentGeneratorTest, ProcessTextWithUnsupportedType3Font) { fxcrt::ostringstream buf; TestProcessText(&generator, &buf, text_obj.get()); // CPDF_PageContentGenerator does not support Type 3 fonts. - // TODO(thestig): Should be empty string. - EXPECT_EQ("q /FXE1 gs BT 1 0 0 1 100 100 Tm ", ByteString(buf)); - // TODO(thestig): Should be false. - EXPECT_TRUE(test_page->GetResources()); + EXPECT_EQ("", ByteString(buf)); + EXPECT_FALSE(test_page->GetResources()); } TEST_F(CPDFPageContentGeneratorTest, ProcessEmptyForm) { From ffa8f64999b4fcfa8af54a28d6b906bb08fa529b Mon Sep 17 00:00:00 2001 From: Antonio Alphonse Date: Tue, 1 Dec 2026 09:17:47 -0800 Subject: [PATCH 08/15] [fuzztest migration] Add FuzzTest version of pdf_jpx_fuzzer pdf_jpx_fuzzer takes in a set of bytes representing an image, and tests the CJPX decoder. The fuzzer takes the first three bytes to use as decoder options, and uses the rest as data for fuzzing. The fuzzer also uses a corpus, stored at corpora/pdf_jpx. This CL introduces a version of pdf_jpx_fuzzer that uses FuzzTest for comparison in performance. The FuzzTest uses four arguments, the first three for setting the decoder options, and the last containing the image data. To allow for access to FuzzTest, the DEPS were modified to allow for including FuzzTest for FuzzTest files. The fuzzers were also run for 1 minute and 30 seconds to gather early results: Libfuzzer LLVM: cov: 442 ft: 558 exec/s: 2943 Centipede LLVM: cov: 441 ft: 1173 exec/s: 5802 Libfuzzer FuzzTest: cov: 545 ft: 531 exec/s: 3168 Centipede FuzzTest: cov: 1148 ft: 3765 exec/s: 6206 Change-Id: Id9176c91ce08eed70c827957aba8f1cba8d78565 Fixed: 581810614 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/163910 Reviewed-by: Lei Zhang Commit-Queue: Lei Zhang --- testing/fuzzers/BUILD.gn | 25 +++++++++++ testing/fuzzers/DEPS | 7 +++ testing/fuzzers/pdf_jpx_fuzztest.cc | 66 +++++++++++++++++++++++++++++ 3 files changed, 98 insertions(+) create mode 100644 testing/fuzzers/pdf_jpx_fuzztest.cc diff --git a/testing/fuzzers/BUILD.gn b/testing/fuzzers/BUILD.gn index d0a85bf87..a2d318b82 100644 --- a/testing/fuzzers/BUILD.gn +++ b/testing/fuzzers/BUILD.gn @@ -2,6 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//testing/test.gni") import("../../pdfium.gni") config("fuzzer_config") { @@ -587,6 +588,30 @@ pdfium_fuzzer("pdf_jpx_fuzzer") { deps = [ ":pdf_jpx_fuzzer_common" ] } +# FuzzTest version of pdf_jpx_fuzzer. FuzzTest is only available in Chromium +# checkouts, and the seed corpus lives in //pdf/pdfium/fuzzers/corpora/pdf_jpx. +if (build_with_chromium) { + test("pdf_jpx_fuzztest") { + sources = [ "pdf_jpx_fuzztest.cc" ] + fuzztests = [ "PdfJpxFuzzTest.DecodeJpx" ] + + # Not using ":fuzzer_config", as FUZZ_TEST() registration requires a global + # constructor, which "pdfium_strict_config" disallows. + configs += [ + "../..:pdfium_core_config", + "../..:pdfium_noshorten_config", + "//build/config/compiler:wexit_time_destructors", + ] + deps = [ + ":fuzzer_init", + ":pdf_jpx_fuzzer_common", + "../:path_service", + "//third_party/fuzztest:fuzztest_gtest_main", + ] + data = [ "//pdf/pdfium/fuzzers/corpora/pdf_jpx/" ] + } +} + pdfium_fuzzer("pdf_psengine_fuzzer") { sources = [ "pdf_psengine_fuzzer.cc" ] deps = [ "../../core/fpdfapi/page" ] diff --git a/testing/fuzzers/DEPS b/testing/fuzzers/DEPS index fe9eaf63e..db4a6e622 100644 --- a/testing/fuzzers/DEPS +++ b/testing/fuzzers/DEPS @@ -2,3 +2,10 @@ include_rules = [ '+fxbarcode', '+xfa', ] + +specific_include_rules = { + # FuzzTest-based fuzzers (only built in Chromium checkouts). + r'.*_fuzztest\.cc': [ + '+third_party/fuzztest/src/fuzztest/fuzztest.h', + ], +} diff --git a/testing/fuzzers/pdf_jpx_fuzztest.cc b/testing/fuzzers/pdf_jpx_fuzztest.cc new file mode 100644 index 000000000..63876a9de --- /dev/null +++ b/testing/fuzzers/pdf_jpx_fuzztest.cc @@ -0,0 +1,66 @@ +// Copyright 2026 The PDFium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include +#include +#include +#include +#include + +#include "core/fxcodec/jpx/cjpx_decoder.h" +#include "core/fxcrt/check.h" +#include "core/fxcrt/span.h" +#include "testing/fuzzers/pdf_jpx_fuzzer_common.h" +#include "testing/utils/path_service.h" +#include "third_party/fuzztest/src/fuzztest/fuzztest.h" + +namespace { + +using JpxSeed = std::tuple>; + +// Relative to the source root. +constexpr char kCorpusDir[] = "pdf/pdfium/fuzzers/corpora/pdf_jpx"; + +// The seed corpus consists of plain JPEG 2000 files, so pair each file with +// the kNone color space option and default values for the other parameters. +std::vector JpxSeeds() { + const std::string source_dir = PathService::GetSourceDir(); + CHECK(!source_dir.empty()); + const std::string corpus_dir = source_dir + "/" + kCorpusDir; + + std::vector seeds; + for (const auto& [contents] : fuzztest::ReadFilesFromDirectory(corpus_dir)) { + std::vector data(contents.begin(), contents.end()); + seeds.emplace_back(CJPX_Decoder::ColorSpaceOption::kNone, + /*resolution_levels_to_skip=*/0, + /*strict_mode=*/false, std::move(data)); + } + // JPX seed corpus not found. + CHECK(!seeds.empty()); + return seeds; +} + +void DecodeJpx(CJPX_Decoder::ColorSpaceOption color_space_option, + uint8_t resolution_levels_to_skip, + bool strict_mode, + pdfium::span data) { + DecodeJpxForFuzzing(data, color_space_option, + resolution_levels_to_skip, strict_mode); +} + +} // namespace + +FUZZ_TEST(PdfJpxFuzzTest, DecodeJpx).WithDomains( + fuzztest::ElementOf({ + CJPX_Decoder::ColorSpaceOption::kNone, + CJPX_Decoder::ColorSpaceOption::kNormal, + CJPX_Decoder::ColorSpaceOption::kIndexed, + }), + fuzztest::Arbitrary(), + fuzztest::Arbitrary(), + fuzztest::Arbitrary>()) + .WithSeeds(JpxSeeds); From 3d0fa6231b4636239196afb065d59745c6045218 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Tue, 1 Dec 2026 09:39:00 -0800 Subject: [PATCH 09/15] Record Rewind() failure in LibjpegScanlineDecoder When LibjpegScanlineDecoder::Rewind() fails, destroy the decompressor and set a `failed_` flag so subsequent scanlines do not repeat InitDecode() and jpeg_common_start_decompress() on every row. Also reset `next_line_` and `last_scanline_` in ScanlineDecoder when Rewind() fails, and guard LibjpegScanlineDecoder::GetNextLine() against reading from an unstarted or destroyed decompressor. Fixed: 588513754 Change-Id: I5aa07f92cb2ed74a4e58c27a81eeb2b1bc16db77 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/165490 Reviewed-by: Lei Zhang Commit-Queue: Tom Sepez --- core/fxcodec/jpeg/jpegmodule_unittest.cpp | 21 +++++++++++++++++++ .../fxcodec/jpeg/libjpeg_scanline_decoder.cpp | 11 ++++++++++ core/fxcodec/jpeg/libjpeg_scanline_decoder.h | 1 + core/fxcodec/scanlinedecoder.cpp | 4 ++++ 4 files changed, 37 insertions(+) diff --git a/core/fxcodec/jpeg/jpegmodule_unittest.cpp b/core/fxcodec/jpeg/jpegmodule_unittest.cpp index 54fcff6b1..55779000f 100644 --- a/core/fxcodec/jpeg/jpegmodule_unittest.cpp +++ b/core/fxcodec/jpeg/jpegmodule_unittest.cpp @@ -142,6 +142,27 @@ TEST(JpegModuleTest, RewindCorruptedDataFails) { // Rewind should fail cleanly. EXPECT_TRUE(decoder->GetScanline(0).empty()); } + +TEST(JpegModuleTest, RewindFailureIsSticky) { + std::vector jpeg_data = LoadMonaLisa(); + ASSERT_FALSE(jpeg_data.empty()); + + std::unique_ptr decoder = + JpegModule::CreateDecoder(jpeg_data, 120, 120, 3, true, 1, false); + ASSERT_TRUE(decoder); + EXPECT_FALSE(decoder->GetScanline(0).empty()); + EXPECT_FALSE(decoder->GetScanline(1).empty()); + + // Save and corrupt the header bytes so Rewind() fails. + std::vector saved_header(jpeg_data.begin(), jpeg_data.begin() + 10); + std::ranges::fill(pdfium::span(jpeg_data).first<10>(), 0); + EXPECT_TRUE(decoder->GetScanline(0).empty()); + + // Restoring the header must not cause subsequent scanlines to retry Rewind(). + std::ranges::copy(saved_header, jpeg_data.begin()); + EXPECT_TRUE(decoder->GetScanline(0).empty()); + EXPECT_TRUE(decoder->GetScanline(2).empty()); +} #endif // !defined(PDF_ENABLE_RUST_JPEG) TEST(JpegModuleTest, CreateDecoderDownscaled) { diff --git a/core/fxcodec/jpeg/libjpeg_scanline_decoder.cpp b/core/fxcodec/jpeg/libjpeg_scanline_decoder.cpp index f89240cf7..f7860d71f 100644 --- a/core/fxcodec/jpeg/libjpeg_scanline_decoder.cpp +++ b/core/fxcodec/jpeg/libjpeg_scanline_decoder.cpp @@ -235,6 +235,10 @@ bool LibjpegScanlineDecoder::CreateImpl(pdfium::span src_span, } bool LibjpegScanlineDecoder::Rewind() { + if (failed_) { + return false; + } + if (started_ || !decompress_created_) { const int expected_orig_width = orig_width_; const int expected_orig_height = orig_height_; @@ -249,6 +253,7 @@ bool LibjpegScanlineDecoder::Rewind() { decompress_created_ = false; } if (!InitDecode(/*bAcceptKnownBadHeader=*/false)) { + failed_ = true; return false; } if (orig_width_ != expected_orig_width || @@ -261,6 +266,7 @@ bool LibjpegScanlineDecoder::Rewind() { jpeg_common_destroy_decompress(&common_); decompress_created_ = false; started_ = false; + failed_ = true; return false; } } @@ -273,6 +279,7 @@ bool LibjpegScanlineDecoder::Rewind() { jpeg_common_destroy_decompress(&common_); decompress_created_ = false; started_ = false; + failed_ = true; return false; } @@ -285,6 +292,7 @@ bool LibjpegScanlineDecoder::Rewind() { jpeg_common_destroy_decompress(&common_); decompress_created_ = false; started_ = false; + failed_ = true; return false; } @@ -293,6 +301,9 @@ bool LibjpegScanlineDecoder::Rewind() { } pdfium::span LibjpegScanlineDecoder::GetNextLine() { + if (!started_ || !decompress_created_) { + return pdfium::span(); + } uint8_t* row_array[] = {scanline_buf_.data()}; int nlines = jpeg_common_read_scanlines(&common_, row_array, 1u); if (nlines <= 0) { diff --git a/core/fxcodec/jpeg/libjpeg_scanline_decoder.h b/core/fxcodec/jpeg/libjpeg_scanline_decoder.h index 47702aa9a..2c7b76a95 100644 --- a/core/fxcodec/jpeg/libjpeg_scanline_decoder.h +++ b/core/fxcodec/jpeg/libjpeg_scanline_decoder.h @@ -71,6 +71,7 @@ class LibjpegScanlineDecoder final : public ScanlineDecoder { DataVector scanline_buf_; bool decompress_created_ = false; bool started_ = false; + bool failed_ = false; bool jpeg_transform_ = false; bool prefer_bgr_output_ = false; uint32_t scale_denom_ = 1; diff --git a/core/fxcodec/scanlinedecoder.cpp b/core/fxcodec/scanlinedecoder.cpp index 640e3c9e7..df76ee75c 100644 --- a/core/fxcodec/scanlinedecoder.cpp +++ b/core/fxcodec/scanlinedecoder.cpp @@ -36,6 +36,8 @@ pdfium::span ScanlineDecoder::GetScanline(int line) { if (next_line_ < 0 || next_line_ > line) { if (!Rewind()) { + next_line_ = -1; + last_scanline_ = pdfium::span(); return pdfium::span(); } next_line_ = 0; @@ -56,6 +58,8 @@ bool ScanlineDecoder::SkipToScanline(int line, PauseIndicatorIface* pPause) { if (next_line_ < 0 || next_line_ > line) { if (!Rewind()) { + next_line_ = -1; + last_scanline_ = pdfium::span(); return false; } next_line_ = 0; From 2a42d28da20eafbe9d80f36a5eef12446d2e4630 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Tue, 1 Dec 2026 10:09:45 -0800 Subject: [PATCH 10/15] Check FT_Outline point and contour limits in CFX_Face::RenderGlyph() Use pdfium::CheckedNumeric in CFX_Face::CloseContours() and CFX_Face::RenderGlyph() so outlines exceeding 16-bit FT_Outline point or contour limits return nullptr instead of truncating. Expose CFX_Face::CloseContours() and add a unit test for the 16-bit point limit. Fixed: 591529584 Change-Id: I665da91f4f6b16c27aaf9753ce17b4b6cfa5ba56 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/165810 Reviewed-by: Lei Zhang Commit-Queue: Tom Sepez --- core/fxge/cfx_face.cpp | 49 +++++++++++++++++++++++++-------- core/fxge/cfx_face.h | 4 +++ core/fxge/cfx_face_unittest.cpp | 16 +++++++++++ 3 files changed, 58 insertions(+), 11 deletions(-) diff --git a/core/fxge/cfx_face.cpp b/core/fxge/cfx_face.cpp index 5ab5c426e..2f3b7f405 100644 --- a/core/fxge/cfx_face.cpp +++ b/core/fxge/cfx_face.cpp @@ -240,14 +240,20 @@ std::unique_ptr ConvertOutline(const skrifa::Outline& outline) { } #if defined(PDF_ENABLE_FREETYPE) -void CloseContours(pdfium::span points, +bool CloseContours(pdfium::span points, std::vector& contours) { - if (!points.empty()) { - uint16_t last = static_cast(points.size() - 1); - if (contours.empty() || contours.back() != last) { - contours.push_back(last); - } + if (points.empty()) { + return true; + } + pdfium::CheckedNumeric last = points.size() - 1; + if (!last.IsValid()) { + return false; } + uint16_t last_val = last.ValueOrDie(); + if (contours.empty() || contours.back() != last_val) { + contours.push_back(last_val); + } + return true; } struct ConvertedFTOutline { @@ -277,7 +283,9 @@ ConvertedFTOutline ConvertToFTOutline(const skrifa::Outline& outline, if (point_idx >= outline.points.size()) { break; } - CloseContours(result.points, result.contours); + if (!CloseContours(result.points, result.contours)) { + return {}; + } result.points.push_back( ToFTVector(outline.points[point_idx++], scaled_matrix)); result.tags.push_back(FT_CURVE_TAG_ON); @@ -323,11 +331,15 @@ ConvertedFTOutline ConvertToFTOutline(const skrifa::Outline& outline, break; } case skrifa::PathVerb::Close: - CloseContours(result.points, result.contours); + if (!CloseContours(result.points, result.contours)) { + return {}; + } break; } } - CloseContours(result.points, result.contours); + if (!CloseContours(result.points, result.contours)) { + return {}; + } return result; } #endif // defined(PDF_ENABLE_FREETYPE) @@ -597,6 +609,14 @@ wchar_t CFX_Face::UnicodeFromAdobeName(const char* name) { NOTREACHED(); } +#if defined(PDF_ENABLE_FONTATIONS) && defined(PDF_ENABLE_FREETYPE) +// static +bool CFX_Face::CloseContoursForTesting(pdfium::span points, + std::vector& contours) { + return CloseContours(points, contours); +} +#endif // defined(PDF_ENABLE_FONTATIONS) && defined(PDF_ENABLE_FREETYPE) + // static ByteString CFX_Face::AdobeNameFromUnicode(wchar_t unicode) { #if defined(PDF_ENABLE_FONTATIONS) @@ -1022,9 +1042,16 @@ std::unique_ptr CFX_Face::RenderGlyph( return nullptr; } + pdfium::CheckedNumeric n_points = converted.points.size(); + pdfium::CheckedNumeric n_contours = + converted.contours.size(); + if (!n_points.IsValid() || !n_contours.IsValid()) { + return nullptr; + } + FT_Outline ft_outline; - ft_outline.n_points = static_cast(converted.points.size()); - ft_outline.n_contours = static_cast(converted.contours.size()); + ft_outline.n_points = n_points.ValueOrDie(); + ft_outline.n_contours = n_contours.ValueOrDie(); ft_outline.points = converted.points.data(); ft_outline.tags = converted.tags.data(); ft_outline.contours = converted.contours.data(); diff --git a/core/fxge/cfx_face.h b/core/fxge/cfx_face.h index 3f8403df0..428ec6920 100644 --- a/core/fxge/cfx_face.h +++ b/core/fxge/cfx_face.h @@ -81,6 +81,10 @@ class CFX_Face final : public Retainable, public Observable { uint32_t face_index); static wchar_t UnicodeFromAdobeName(const char* name); static ByteString AdobeNameFromUnicode(wchar_t unicode); +#if defined(PDF_ENABLE_FONTATIONS) && defined(PDF_ENABLE_FREETYPE) + static bool CloseContoursForTesting(pdfium::span points, + std::vector& contours); +#endif // defined(PDF_ENABLE_FONTATIONS) && defined(PDF_ENABLE_FREETYPE) bool HasGlyphNames() const; bool IsTtOt() const; diff --git a/core/fxge/cfx_face_unittest.cpp b/core/fxge/cfx_face_unittest.cpp index 692da8338..a17f9300a 100644 --- a/core/fxge/cfx_face_unittest.cpp +++ b/core/fxge/cfx_face_unittest.cpp @@ -5,6 +5,7 @@ #include "core/fxge/cfx_face.h" #include +#include #include "core/fxcrt/cfx_read_only_span_stream.h" #include "core/fxge/cfx_gemodule.h" @@ -74,4 +75,19 @@ TEST(CFXFaceTest, BuiltInGenericFontScaling) { unscaled_bitmap->GetBitmap()->GetWidth()); #endif // defined(PDF_ENABLE_FREETYPE) } + +#if defined(PDF_ENABLE_FREETYPE) +TEST(CFXFaceTest, CloseContoursPointLimit) { + std::vector contours; + std::vector points(65536); + EXPECT_TRUE(CFX_Face::CloseContoursForTesting(points, contours)); + ASSERT_EQ(contours.size(), 1u); + EXPECT_EQ(contours[0], 65535u); + + contours.clear(); + points.resize(65537); + EXPECT_FALSE(CFX_Face::CloseContoursForTesting(points, contours)); + EXPECT_TRUE(contours.empty()); +} +#endif // defined(PDF_ENABLE_FREETYPE) #endif // defined(PDF_ENABLE_FONTATIONS) From f1292c055a8c213149ff6c2041f894598da0f98d Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Tue, 1 Dec 2026 16:05:57 -0800 Subject: [PATCH 11/15] Enable transparent comparison in CFXJSE_Engine maps. Avoid creating a temporary Persistent<> for lookup when comparison against a pointer may suffice. Change-Id: I5c68891661d645362932fce8595e70021fa0fcf1 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/165931 Commit-Queue: Tom Sepez Reviewed-by: Andy Phan --- fxjs/xfa/cfxjse_engine.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fxjs/xfa/cfxjse_engine.h b/fxjs/xfa/cfxjse_engine.h index f1d176e62..edee54b44 100644 --- a/fxjs/xfa/cfxjse_engine.h +++ b/fxjs/xfa/cfxjse_engine.h @@ -7,6 +7,7 @@ #ifndef FXJS_XFA_CFXJSE_ENGINE_H_ #define FXJS_XFA_CFXJSE_ENGINE_H_ +#include #include #include #include @@ -219,9 +220,11 @@ class CFXJSE_Engine final : public CFX_IsolateWrapper { CXFA_Script::Type script_type_ = CXFA_Script::Type::Unknown; // |map_object_to_value_| is what ensures the v8 object bound to a // CJX_Object remains valid for the lifetime of the engine. - std::map, v8::Global> + std::map, v8::Global, std::less<>> map_object_to_object_; - std::map, std::unique_ptr> + std::map, + std::unique_ptr, + std::less<>> map_variable_to_context_; cppgc::Persistent target_; UnownedPtr event_param_; From 884eab85f93b34259fb9cfe08ccdaa972f7fd708 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Tue, 1 Dec 2026 16:59:46 -0800 Subject: [PATCH 12/15] Explicitly list data files in testing/tools/BUILD.gn Instead of having an entry for "." to implicitly include everything in the directory, explicitly list the files to include. This is a mechanical change but has a side effect of not accidentally including files from testing/tools that git is not tracking. The list of files comes from `git ls-files testing/tools` in a pristine checkout. Change-Id: I0d27d2f548eb4159384c3961c056e40318d61909 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/165950 Commit-Queue: Lei Zhang Reviewed-by: Tom Sepez --- testing/tools/BUILD.gn | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/testing/tools/BUILD.gn b/testing/tools/BUILD.gn index 5b6847d7f..c4b75d75d 100644 --- a/testing/tools/BUILD.gn +++ b/testing/tools/BUILD.gn @@ -22,7 +22,46 @@ if (pdf_is_standalone) { # Unbuilt runtime dependencies. data = [ - ".", + "BUILD.gn", + "PRESUBMIT.py", + "__init__.py", + "adb_push_tests.sh", + "api_check.py", + "common.py", + "coverage/coverage_report.py", + "encode_pdf_filter.py", + "find_performance_steps.py", + "find_surprise_passes.py", + "fixup_pdf_template.py", + "generate_cas_paths.py", + "githelper.py", + "golden_fetch.sh", + "libclang_check.py", + "libclang_check_test.py", + "libcxx_check.py", + "make_expected.sh", + "pdfium_root.py", + "pdftoin_shrdlu.py", + "pngdiffer.py", + "renumber.py", + "run_corpus_tests.py", + "run_drawing_tests.py", + "run_javascript_tests.py", + "run_pixel_tests.py", + "safetynet_compare.py", + "safetynet_conclusions.py", + "safetynet_image.py", + "safetynet_job.py", + "safetynet_measure.py", + "skia_gold/__init__.py", + "skia_gold/pdfium_skia_gold_properties.py", + "skia_gold/pdfium_skia_gold_session.py", + "skia_gold/pdfium_skia_gold_session_manager.py", + "skia_gold/skia_gold.py", + "strip_jp2_comments.py", + "suppressor.py", + "test_runner.py", + "text_diff.py", "../SUPPRESSIONS", "../corpus/", "../../build/skia_gold_common/", From 5a24338b9bbe8c466b1f705a9dd5a67432b3a447 Mon Sep 17 00:00:00 2001 From: deepak1556 Date: Tue, 1 Dec 2026 18:30:26 -0800 Subject: [PATCH 13/15] [fxjs] Migrate to Function/PropertyCallbackInfo::Data() from DataV2() This is a pure mechanical change replacing deprecated DataV2() calls with Data() to complete the API migration. Bug: 559925519 Change-Id: I25e45d84a9475f986a3062201b1a38eada1d5dae Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/165030 Commit-Queue: Lei Zhang Auto-Submit: Deepak Mohan (Robo) Reviewed-by: Tom Sepez Reviewed-by: Lei Zhang --- fxjs/cfxjs_engine.cpp | 2 +- fxjs/xfa/cfxjse_class.cpp | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/fxjs/cfxjs_engine.cpp b/fxjs/cfxjs_engine.cpp index 0aad165dd..7fa7d49fc 100644 --- a/fxjs/cfxjs_engine.cpp +++ b/fxjs/cfxjs_engine.cpp @@ -187,7 +187,7 @@ class CFXJS_ObjDefinition { fxv8::ThrowExceptionHelper(isolate, "illegal constructor"); return; } - if (info.DataV2().As()->Value() != FXJSOBJTYPE_DYNAMIC) { + if (info.Data().As()->Value() != FXJSOBJTYPE_DYNAMIC) { fxv8::ThrowExceptionHelper(isolate, "not a dynamic object"); return; } diff --git a/fxjs/xfa/cfxjse_class.cpp b/fxjs/xfa/cfxjse_class.cpp index fc84c7165..9bf535e9f 100644 --- a/fxjs/xfa/cfxjse_class.cpp +++ b/fxjs/xfa/cfxjse_class.cpp @@ -46,7 +46,7 @@ FXJSE_CLASS_DESCRIPTOR* AsClassDescriptor(void* ptr) { void V8FunctionCallback_Wrapper( const v8::FunctionCallbackInfo& info) { const FXJSE_FUNCTION_DESCRIPTOR* function_info = - AsFunctionDescriptor(info.DataV2().As()->Value( + AsFunctionDescriptor(info.Data().As()->Value( v8::kExternalPointerTypeTagDefault)); if (!function_info) { return; @@ -69,7 +69,7 @@ void V8ConstructorCallback_Wrapper( } const FXJSE_CLASS_DESCRIPTOR* pClassDescriptor = - AsClassDescriptor(info.DataV2().As()->Value( + AsClassDescriptor(info.Data().As()->Value( v8::kExternalPointerTypeTagDefault)); if (!pClassDescriptor) { return; @@ -84,7 +84,7 @@ void V8ConstructorCallback_Wrapper( void Context_GlobalObjToString( const v8::FunctionCallbackInfo& info) { const FXJSE_CLASS_DESCRIPTOR* pClassDescriptor = - AsClassDescriptor(info.DataV2().As()->Value( + AsClassDescriptor(info.Data().As()->Value( v8::kExternalPointerTypeTagDefault)); if (!pClassDescriptor) { return; @@ -106,7 +106,7 @@ void Context_GlobalObjToString( void DynPropGetterAdapter_MethodCallback( const v8::FunctionCallbackInfo& info) { v8::Local hCallBackInfo = - info.DataV2().As().As(); + info.Data().As().As(); if (hCallBackInfo->InternalFieldCount() != 2) { return; } @@ -218,7 +218,7 @@ v8::Intercepted NamedPropertyQueryCallback( v8::Local property, const v8::PropertyCallbackInfo& info) { const FXJSE_CLASS_DESCRIPTOR* pClass = - AsClassDescriptor(info.DataV2().As()->Value( + AsClassDescriptor(info.Data().As()->Value( v8::kExternalPointerTypeTagDefault)); if (!pClass) { return v8::Intercepted::kNo; @@ -242,7 +242,7 @@ v8::Intercepted NamedPropertyGetterCallback( v8::Local property, const v8::PropertyCallbackInfo& info) { const FXJSE_CLASS_DESCRIPTOR* pClass = - AsClassDescriptor(info.DataV2().As()->Value( + AsClassDescriptor(info.Data().As()->Value( v8::kExternalPointerTypeTagDefault)); if (!pClass) { return v8::Intercepted::kNo; @@ -263,7 +263,7 @@ v8::Intercepted NamedPropertySetterCallback( v8::Local value, const v8::PropertyCallbackInfo& info) { const FXJSE_CLASS_DESCRIPTOR* pClass = - AsClassDescriptor(info.DataV2().As()->Value( + AsClassDescriptor(info.Data().As()->Value( v8::kExternalPointerTypeTagDefault)); if (!pClass) { return v8::Intercepted::kNo; From 4a550bd23f14c82877c9b0e9218b657ad3e91aff Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Wed, 2 Dec 2026 05:05:07 -0800 Subject: [PATCH 14/15] Consolidate optimized JBIG2 row decoding code The optimized (nominal AT pixel) generic region decoders were seven near-copies of the same row loop: DecodeArithOpt3<0..2>, DecodeArithTemplate3Opt3, the progressive template 0-3 drivers and their shared helper. Instead, use a trait template to have just one copy. No intended behavior change or performance change. Preparation for speeding up this code, which I'd rather do in just one place :) Bug: 584665243 Change-Id: I0d1182814cf25ca96b351f6c7c5969bed16c8d50 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/165330 Reviewed-by: Lei Zhang Commit-Queue: Nico Weber Reviewed-by: Nico Weber --- core/fxcodec/jbig2/jbig2_grd_proc.cpp | 669 ++++++++------------------ core/fxcodec/jbig2/jbig2_grd_proc.h | 33 +- 2 files changed, 202 insertions(+), 500 deletions(-) diff --git a/core/fxcodec/jbig2/jbig2_grd_proc.cpp b/core/fxcodec/jbig2/jbig2_grd_proc.cpp index f234e7727..afeea70c5 100644 --- a/core/fxcodec/jbig2/jbig2_grd_proc.cpp +++ b/core/fxcodec/jbig2/jbig2_grd_proc.cpp @@ -17,27 +17,12 @@ #include "core/fxcodec/jbig2/jbig2_image.h" #include "core/fxcrt/check_op.h" #include "core/fxcrt/pauseindicator_iface.h" -#include "core/fxcrt/zip.h" +#include "core/fxcrt/span.h" namespace { // TODO(crbug.com/567627774): Name this constants better or merge some together. -constexpr std::array kOptConstant1 = { - {0x9b25, 0x0795, 0x00e5}}; -constexpr std::array kOptConstant2 = { - {0x0006, 0x0004, 0x0001}}; -constexpr std::array kOptConstant3 = { - {0xf800, 0x1e00, 0x0380}}; -constexpr std::array kOptConstant4 = { - {0x0000, 0x0001, 0x0003}}; -constexpr std::array kOptConstant5 = { - {0x07f0, 0x01f8, 0x007c}}; -constexpr std::array kOptConstant6 = { - {0x7bf7, 0x0efb, 0x01bd}}; -constexpr std::array kOptConstant7 = { - {0x0800, 0x0200, 0x0080}}; -constexpr std::array kOptConstant8 = { - {0x0010, 0x0008, 0x0004}}; +// They are only used by DecodeArithTemplateUnopt(). constexpr std::array kOptConstant9 = { {0x000c, 0x0009, 0x0007}}; constexpr std::array kOptConstant10 = { @@ -47,12 +32,173 @@ constexpr std::array kOptConstant11 = { constexpr std::array kOptConstant12 = { {0x000f, 0x0007, 0x0003}}; +// The generic region templates (6.2.5.3), for the optimized decoders that +// handle the nominal AT pixel positions. +template +struct TemplateTraits; + +template <> +struct TemplateTraits<0> { + // The context in which SLTP is decoded (6.2.5.7). + static constexpr uint32_t kTpContext = 0x9b25; + static constexpr uint32_t kContextMask = 0x7bf7; + static constexpr int kRow1Shift = 0; + static constexpr uint32_t kRow1ContextMask = 0x07f0; + static constexpr uint32_t kRow1BitMask = 0x0010; + static constexpr bool kHasRow2 = true; + static constexpr int kRow2Shift = 6; + static constexpr uint32_t kRow2ContextMask = 0xf800; + static constexpr uint32_t kRow2BitMask = 0x0800; + // TODO(crbug.com/567627774): Why is the height only trimmed for template 0? + static constexpr bool kTrimHeight = true; + // Whether the progressive decoder checks for a pause only every 50 rows. + static constexpr bool kPauseEvery50Rows = false; +}; + +template <> +struct TemplateTraits<1> { + static constexpr uint32_t kTpContext = 0x0795; + static constexpr uint32_t kContextMask = 0x0efb; + static constexpr int kRow1Shift = 1; + static constexpr uint32_t kRow1ContextMask = 0x01f8; + static constexpr uint32_t kRow1BitMask = 0x0008; + static constexpr bool kHasRow2 = true; + static constexpr int kRow2Shift = 4; + static constexpr uint32_t kRow2ContextMask = 0x1e00; + static constexpr uint32_t kRow2BitMask = 0x0200; + static constexpr bool kTrimHeight = false; + static constexpr bool kPauseEvery50Rows = false; +}; + +template <> +struct TemplateTraits<2> { + static constexpr uint32_t kTpContext = 0x00e5; + static constexpr uint32_t kContextMask = 0x01bd; + static constexpr int kRow1Shift = 3; + static constexpr uint32_t kRow1ContextMask = 0x007c; + static constexpr uint32_t kRow1BitMask = 0x0004; + static constexpr bool kHasRow2 = true; + static constexpr int kRow2Shift = 1; + static constexpr uint32_t kRow2ContextMask = 0x0380; + static constexpr uint32_t kRow2BitMask = 0x0080; + static constexpr bool kTrimHeight = false; + static constexpr bool kPauseEvery50Rows = true; +}; + +template <> +struct TemplateTraits<3> { + static constexpr uint32_t kTpContext = 0x0195; + static constexpr uint32_t kContextMask = 0x01f7; + static constexpr int kRow1Shift = 1; + static constexpr uint32_t kRow1ContextMask = 0x03f0; + static constexpr uint32_t kRow1BitMask = 0x0010; + // Template 3 only looks one row up. kRow2Shift and kRow2ContextMask are + // only used under `if constexpr (kHasRow2)`. + static constexpr bool kHasRow2 = false; + static constexpr uint32_t kRow2BitMask = 0; + static constexpr bool kTrimHeight = false; + static constexpr bool kPauseEvery50Rows = false; +}; + struct LineLayout { uint32_t full_bytes; // Range of values is [1, 8]. uint32_t last_byte_bits; }; +// Decode row `row` of an optimized generic region into `line`. `prev1` and +// `prev2` are the two rows above it. Returns false if data runs out. +template +bool DecodeOpt3Row(CJBig2_ArithDecoder* decoder, + pdfium::span contexts, + uint32_t row, + pdfium::span prev2, + pdfium::span prev1, + pdfium::span line, + const LineLayout& layout) { + if (row < (Traits::kHasRow2 ? 2u : 1u)) { + const bool has_prev1 = row > 0; + uint32_t val_prev = has_prev1 ? prev1[0] : 0; + uint32_t context = + (val_prev >> Traits::kRow1Shift) & Traits::kRow1ContextMask; + for (uint32_t cc = 0; cc < layout.full_bytes; ++cc) { + if (has_prev1) { + val_prev = (val_prev << 8) | prev1[cc + 1]; + } + uint8_t byte = 0; + for (int32_t k = 7; k >= 0; --k) { + if (decoder->IsComplete()) { + return false; + } + const int bit = decoder->Decode(&contexts[context]); + byte |= bit << k; + context = + ((context & Traits::kContextMask) << 1) | bit | + ((val_prev >> (k + Traits::kRow1Shift)) & Traits::kRow1BitMask); + } + line[cc] = byte; + } + val_prev <<= 8; + uint8_t byte = 0; + for (uint32_t k = 0; k < layout.last_byte_bits; ++k) { + if (decoder->IsComplete()) { + return false; + } + const int bit = decoder->Decode(&contexts[context]); + byte |= bit << (7 - k); + context = + ((context & Traits::kContextMask) << 1) | bit | + ((val_prev >> (7 - k + Traits::kRow1Shift)) & Traits::kRow1BitMask); + } + line[layout.full_bytes] = byte; + return true; + } + + uint32_t val_prev2 = 0; + uint32_t context = 0; + if constexpr (Traits::kHasRow2) { + val_prev2 = prev2[0] << Traits::kRow2Shift; + context = val_prev2 & Traits::kRow2ContextMask; + } + uint32_t val_prev1 = prev1[0]; + context |= (val_prev1 >> Traits::kRow1Shift) & Traits::kRow1ContextMask; + for (uint32_t cc = 0; cc < layout.full_bytes; ++cc) { + if constexpr (Traits::kHasRow2) { + val_prev2 = (val_prev2 << 8) | (prev2[cc + 1] << Traits::kRow2Shift); + } + val_prev1 = (val_prev1 << 8) | prev1[cc + 1]; + uint8_t byte = 0; + for (int32_t k = 7; k >= 0; --k) { + if (decoder->IsComplete()) { + return false; + } + const int bit = decoder->Decode(&contexts[context]); + byte |= bit << k; + context = + ((context & Traits::kContextMask) << 1) | bit | + ((val_prev2 >> k) & Traits::kRow2BitMask) | + ((val_prev1 >> (k + Traits::kRow1Shift)) & Traits::kRow1BitMask); + } + line[cc] = byte; + } + val_prev2 <<= 8; + val_prev1 <<= 8; + uint8_t byte = 0; + for (uint32_t k = 0; k < layout.last_byte_bits; ++k) { + if (decoder->IsComplete()) { + return false; + } + const int bit = decoder->Decode(&contexts[context]); + byte |= bit << (7 - k); + context = + ((context & Traits::kContextMask) << 1) | bit | + ((val_prev2 >> (7 - k)) & Traits::kRow2BitMask) | + ((val_prev1 >> (7 - k + Traits::kRow1Shift)) & Traits::kRow1BitMask); + } + line[layout.full_bytes] = byte; + return true; +} + LineLayout GetLineLayout(uint32_t width) { CHECK_GT(width, 0u); // Note that this deliberately represents 8 bits as: @@ -109,15 +255,16 @@ std::unique_ptr CJBig2_GRDProc::DecodeArith( : DecodeArithTemplateUnopt<2>(pArithDecoder, gbContexts); default: return UseTemplate23Opt3() - ? DecodeArithTemplate3Opt3(pArithDecoder, gbContexts) + ? DecodeArithOpt3<3>(pArithDecoder, gbContexts) : DecodeArithTemplate3Unopt(pArithDecoder, gbContexts); } } -template +template std::unique_ptr CJBig2_GRDProc::DecodeArithOpt3( CJBig2_ArithDecoder* pArithDecoder, pdfium::span gbContexts) { + using Traits = TemplateTraits; auto GBREG = std::make_unique(GBW, GBH); if (!GBREG->has_data()) { return nullptr; @@ -125,8 +272,7 @@ std::unique_ptr CJBig2_GRDProc::DecodeArithOpt3( int LTP = 0; const LineLayout layout = GetLineLayout(GBW); - // TODO(crbug.com/567627774): Why is the height only trimmed when OPT is 0? - const uint32_t height = OPT == 0 ? GBH & 0x7fffffff : GBH; + const uint32_t height = Traits::kTrimHeight ? GBH & 0x7fffffff : GBH; pdfium::span row_write; pdfium::span row_prev1; pdfium::span row_prev2; @@ -139,98 +285,16 @@ std::unique_ptr CJBig2_GRDProc::DecodeArithOpt3( return nullptr; } - LTP = LTP ^ pArithDecoder->Decode(&gbContexts[kOptConstant1[OPT]]); + LTP = LTP ^ pArithDecoder->Decode(&gbContexts[Traits::kTpContext]); if (LTP) { GBREG->CopyLine(row_write, row_prev1); continue; } } - - if (h < 2) { - const bool is_second_line = h == 1; - uint32_t val_prev = 0; - if (is_second_line) { - val_prev = row_prev1[0]; - } - uint32_t CONTEXT = - ((val_prev >> kOptConstant4[OPT]) & kOptConstant5[OPT]); - for (uint32_t cc = 0; cc < layout.full_bytes; ++cc) { - if (is_second_line) { - val_prev = (val_prev << 8) | row_prev1[cc + 1]; - } - uint8_t cVal = 0; - for (int32_t k = 7; k >= 0; --k) { - if (pArithDecoder->IsComplete()) { - return nullptr; - } - - int bVal = pArithDecoder->Decode(&gbContexts[CONTEXT]); - cVal |= bVal << k; - CONTEXT = - (((CONTEXT & kOptConstant6[OPT]) << 1) | bVal | - ((val_prev >> (k + kOptConstant4[OPT])) & kOptConstant8[OPT])); - } - row_write[cc] = cVal; - } - val_prev <<= 8; - uint8_t cVal1 = 0; - for (uint32_t k = 0; k < layout.last_byte_bits; ++k) { - if (pArithDecoder->IsComplete()) { - return nullptr; - } - - int bVal = pArithDecoder->Decode(&gbContexts[CONTEXT]); - cVal1 |= bVal << (7 - k); - CONTEXT = (((CONTEXT & kOptConstant6[OPT]) << 1) | bVal | - (((val_prev >> (7 + kOptConstant4[OPT] - k))) & - kOptConstant8[OPT])); - } - row_write[layout.full_bytes] = cVal1; - continue; + if (!DecodeOpt3Row(pArithDecoder, gbContexts, h, row_prev2, + row_prev1, row_write, layout)) { + return nullptr; } - - uint32_t val_prev2 = row_prev2[0] << kOptConstant2[OPT]; - uint32_t val_prev1 = row_prev1[0]; - uint32_t CONTEXT = (val_prev2 & kOptConstant3[OPT]) | - ((val_prev1 >> kOptConstant4[OPT]) & kOptConstant5[OPT]); - auto row_write_zip = row_write.first(layout.full_bytes); - auto row_prev1_zip = row_prev1.subspan<1u>(); - auto row_prev2_zip = row_prev2.subspan<1u>(); - for (auto [elem_write, elem_prev1, elem_prev2] : - fxcrt::Zip(row_write_zip, row_prev1_zip, row_prev2_zip)) { - val_prev2 = (val_prev2 << 8) | (elem_prev2 << kOptConstant2[OPT]); - val_prev1 = (val_prev1 << 8) | elem_prev1; - uint8_t cVal = 0; - for (int32_t k = 7; k >= 0; --k) { - if (pArithDecoder->IsComplete()) { - return nullptr; - } - - int bVal = pArithDecoder->Decode(&gbContexts[CONTEXT]); - cVal |= bVal << k; - CONTEXT = - (((CONTEXT & kOptConstant6[OPT]) << 1) | bVal | - ((val_prev2 >> k) & kOptConstant7[OPT]) | - ((val_prev1 >> (k + kOptConstant4[OPT])) & kOptConstant8[OPT])); - } - elem_write = cVal; - } - val_prev2 <<= 8; - val_prev1 <<= 8; - uint8_t cVal1 = 0; - for (uint32_t k = 0; k < layout.last_byte_bits; ++k) { - if (pArithDecoder->IsComplete()) { - return nullptr; - } - - int bVal = pArithDecoder->Decode(&gbContexts[CONTEXT]); - cVal1 |= bVal << (7 - k); - CONTEXT = - (((CONTEXT & kOptConstant6[OPT]) << 1) | bVal | - ((val_prev2 >> (7 - k)) & kOptConstant7[OPT]) | - ((val_prev1 >> (7 + kOptConstant4[OPT] - k)) & kOptConstant8[OPT])); - } - row_write[layout.full_bytes] = cVal1; } return GBREG; } @@ -261,7 +325,8 @@ std::unique_ptr CJBig2_GRDProc::DecodeArithTemplateUnopt( return nullptr; } - LTP = LTP ^ pArithDecoder->Decode(&gbContexts[kOptConstant1[UNOPT]]); + LTP = LTP ^ pArithDecoder->Decode( + &gbContexts[TemplateTraits::kTpContext]); if (LTP) { GBREG->CopyLine(row_write, row_prev1); continue; @@ -326,96 +391,6 @@ std::unique_ptr CJBig2_GRDProc::DecodeArithTemplateUnopt( return GBREG; } -std::unique_ptr CJBig2_GRDProc::DecodeArithTemplate3Opt3( - CJBig2_ArithDecoder* pArithDecoder, - pdfium::span gbContexts) { - auto GBREG = std::make_unique(GBW, GBH); - if (!GBREG->has_data()) { - return nullptr; - } - - int LTP = 0; - const LineLayout layout = GetLineLayout(GBW); - pdfium::span row_write; - pdfium::span row_prev; - for (uint32_t h = 0; h < GBH; h++) { - row_prev = row_write; - row_write = GBREG->GetLine(h); - if (TPGDON) { - if (pArithDecoder->IsComplete()) { - return nullptr; - } - - LTP = LTP ^ pArithDecoder->Decode(&gbContexts[0x0195]); - if (LTP) { - GBREG->CopyLine(row_write, row_prev); - continue; - } - } - - if (h == 0) { - uint32_t CONTEXT = 0; - for (uint32_t cc = 0; cc < layout.full_bytes; cc++) { - uint8_t cVal = 0; - for (int32_t k = 7; k >= 0; k--) { - if (pArithDecoder->IsComplete()) { - return nullptr; - } - - int bVal = pArithDecoder->Decode(&gbContexts[CONTEXT]); - cVal |= bVal << k; - CONTEXT = ((CONTEXT & 0x01f7) << 1) | bVal; - } - row_write[cc] = cVal; - } - uint8_t cVal1 = 0; - for (uint32_t k = 0; k < layout.last_byte_bits; k++) { - if (pArithDecoder->IsComplete()) { - return nullptr; - } - - int bVal = pArithDecoder->Decode(&gbContexts[CONTEXT]); - cVal1 |= bVal << (7 - k); - CONTEXT = ((CONTEXT & 0x01f7) << 1) | bVal; - } - row_write[layout.full_bytes] = cVal1; - continue; - } - - uint32_t val_prev = row_prev[0]; - uint32_t CONTEXT = (val_prev >> 1) & 0x03f0; - for (uint32_t cc = 0; cc < layout.full_bytes; cc++) { - val_prev = (val_prev << 8) | row_prev[cc + 1]; - uint8_t cVal = 0; - for (int32_t k = 7; k >= 0; k--) { - if (pArithDecoder->IsComplete()) { - return nullptr; - } - - int bVal = pArithDecoder->Decode(&gbContexts[CONTEXT]); - cVal |= bVal << k; - CONTEXT = - ((CONTEXT & 0x01f7) << 1) | bVal | ((val_prev >> (k + 1)) & 0x0010); - } - row_write[cc] = cVal; - } - val_prev <<= 8; - uint8_t cVal1 = 0; - for (uint32_t k = 0; k < layout.last_byte_bits; k++) { - if (pArithDecoder->IsComplete()) { - return nullptr; - } - - int bVal = pArithDecoder->Decode(&gbContexts[CONTEXT]); - cVal1 |= bVal << (7 - k); - CONTEXT = - ((CONTEXT & 0x01f7) << 1) | bVal | ((val_prev >> (8 - k)) & 0x0010); - } - row_write[layout.full_bytes] = cVal1; - } - return GBREG; -} - std::unique_ptr CJBig2_GRDProc::DecodeArithTemplate3Unopt( CJBig2_ArithDecoder* pArithDecoder, pdfium::span gbContexts) { @@ -510,22 +485,22 @@ FXCODEC_STATUS CJBig2_GRDProc::ProgressiveDecodeArith( switch (GBTEMPLATE) { case 0: func = UseTemplate0Opt3() - ? &CJBig2_GRDProc::ProgressiveDecodeArithTemplate0Opt3 + ? &CJBig2_GRDProc::ProgressiveDecodeArithOpt3<0> : &CJBig2_GRDProc::ProgressiveDecodeArithTemplate0Unopt; break; case 1: func = UseTemplate1Opt3() - ? &CJBig2_GRDProc::ProgressiveDecodeArithTemplate1Opt3 + ? &CJBig2_GRDProc::ProgressiveDecodeArithOpt3<1> : &CJBig2_GRDProc::ProgressiveDecodeArithTemplate1Unopt; break; case 2: func = UseTemplate23Opt3() - ? &CJBig2_GRDProc::ProgressiveDecodeArithTemplate2Opt3 + ? &CJBig2_GRDProc::ProgressiveDecodeArithOpt3<2> : &CJBig2_GRDProc::ProgressiveDecodeArithTemplate2Unopt; break; default: func = UseTemplate23Opt3() - ? &CJBig2_GRDProc::ProgressiveDecodeArithTemplate3Opt3 + ? &CJBig2_GRDProc::ProgressiveDecodeArithOpt3<3> : &CJBig2_GRDProc::ProgressiveDecodeArithTemplate3Unopt; break; } @@ -588,31 +563,38 @@ void CJBig2_GRDProc::FinishDecode() { line_ = {}; } -FXCODEC_STATUS CJBig2_GRDProc::ProgressiveDecodeArithTemplate0Opt3( +template +FXCODEC_STATUS CJBig2_GRDProc::ProgressiveDecodeArithOpt3( ProgressiveArithDecodeState* pState) { + using Traits = TemplateTraits; CJBig2_Image* pImage = pState->pImage->get(); if (line_.empty()) { line_ = pImage->span(); } - static constexpr TemplateOpt3Params kParams = {.tp_ctx = 0x9b25, - .context_mask = 0x7bf7, - .val1_shift = 0, - .val1_context_mask = 0x07f0, - .val1_bit_mask = 0x0010, - .val2_shift = 6, - .val2_context_mask = 0xf800, - .val2_bit_mask = 0x0800}; const LineLayout layout = GetLineLayout(GBW); - const uint32_t height = GBH & 0x7fffffff; + const uint32_t height = Traits::kTrimHeight ? GBH & 0x7fffffff : GBH; for (; loop_index_ < height; loop_index_++) { - if (!ProgressiveDecodeArithTemplateOpt3Helper( - pState, kParams, layout.full_bytes, layout.last_byte_bits)) { + if (TPGDON) { + if (pState->pArithDecoder->IsComplete()) { + return FXCODEC_STATUS::kError; + } + + ltp_ = ltp_ ^ pState->pArithDecoder->Decode( + &pState->gbContexts[Traits::kTpContext]); + } + if (ltp_) { + CopyPrevLine(pImage); + } else if (!DecodeOpt3Row(pState->pArithDecoder, pState->gbContexts, + loop_index_, line_prev2_, line_prev1_, + line_, layout)) { return FXCODEC_STATUS::kError; } AdvanceLine(pImage); - if (pState->pPause && pState->pPause->NeedToPauseNow()) { + if (pState->pPause && + (!Traits::kPauseEvery50Rows || loop_index_ % 50 == 0) && + pState->pPause->NeedToPauseNow()) { loop_index_++; progressive_status_ = FXCODEC_STATUS::kDecodeToBeContinued; return FXCODEC_STATUS::kDecodeToBeContinued; @@ -699,39 +681,6 @@ FXCODEC_STATUS CJBig2_GRDProc::ProgressiveDecodeArithTemplate0Unopt( return FXCODEC_STATUS::kDecodeFinished; } -FXCODEC_STATUS CJBig2_GRDProc::ProgressiveDecodeArithTemplate1Opt3( - ProgressiveArithDecodeState* pState) { - CJBig2_Image* pImage = pState->pImage->get(); - if (line_.empty()) { - line_ = pImage->span(); - } - - static constexpr TemplateOpt3Params kParams = {.tp_ctx = 0x0795, - .context_mask = 0x0efb, - .val1_shift = 1, - .val1_context_mask = 0x01f8, - .val1_bit_mask = 0x0008, - .val2_shift = 4, - .val2_context_mask = 0x1e00, - .val2_bit_mask = 0x0200}; - const LineLayout layout = GetLineLayout(GBW); - for (; loop_index_ < GBH; loop_index_++) { - if (!ProgressiveDecodeArithTemplateOpt3Helper( - pState, kParams, layout.full_bytes, layout.last_byte_bits)) { - return FXCODEC_STATUS::kError; - } - - AdvanceLine(pImage); - if (pState->pPause && pState->pPause->NeedToPauseNow()) { - loop_index_++; - progressive_status_ = FXCODEC_STATUS::kDecodeToBeContinued; - return FXCODEC_STATUS::kDecodeToBeContinued; - } - } - progressive_status_ = FXCODEC_STATUS::kDecodeFinished; - return FXCODEC_STATUS::kDecodeFinished; -} - FXCODEC_STATUS CJBig2_GRDProc::ProgressiveDecodeArithTemplate1Unopt( ProgressiveArithDecodeState* pState) { CJBig2_Image* pImage = pState->pImage->get(); @@ -801,139 +750,6 @@ FXCODEC_STATUS CJBig2_GRDProc::ProgressiveDecodeArithTemplate1Unopt( return FXCODEC_STATUS::kDecodeFinished; } -FXCODEC_STATUS CJBig2_GRDProc::ProgressiveDecodeArithTemplate2Opt3( - ProgressiveArithDecodeState* pState) { - CJBig2_Image* pImage = pState->pImage->get(); - if (line_.empty()) { - line_ = pImage->span(); - } - - static constexpr TemplateOpt3Params kParams = {.tp_ctx = 0x00e5, - .context_mask = 0x01bd, - .val1_shift = 3, - .val1_context_mask = 0x007c, - .val1_bit_mask = 0x0004, - .val2_shift = 1, - .val2_context_mask = 0x0380, - .val2_bit_mask = 0x0080}; - const LineLayout layout = GetLineLayout(GBW); - for (; loop_index_ < GBH; loop_index_++) { - if (!ProgressiveDecodeArithTemplateOpt3Helper( - pState, kParams, layout.full_bytes, layout.last_byte_bits)) { - return FXCODEC_STATUS::kError; - } - - AdvanceLine(pImage); - if (pState->pPause && loop_index_ % 50 == 0 && - pState->pPause->NeedToPauseNow()) { - loop_index_++; - progressive_status_ = FXCODEC_STATUS::kDecodeToBeContinued; - return FXCODEC_STATUS::kDecodeToBeContinued; - } - } - progressive_status_ = FXCODEC_STATUS::kDecodeFinished; - return FXCODEC_STATUS::kDecodeFinished; -} - -bool CJBig2_GRDProc::ProgressiveDecodeArithTemplateOpt3Helper( - ProgressiveArithDecodeState* state, - const TemplateOpt3Params& params, - uint32_t nLineBytes, - uint32_t nBitsLeft) { - if (TPGDON) { - if (state->pArithDecoder->IsComplete()) { - return false; - } - - ltp_ = - ltp_ ^ state->pArithDecoder->Decode(&state->gbContexts[params.tp_ctx]); - } - if (ltp_) { - CopyPrevLine(state->pImage->get()); - return true; - } - - if (loop_index_ <= 1) { - const bool is_second_line = loop_index_ == 1; - uint32_t val_prev = is_second_line ? line_prev1_[0] : 0; - uint32_t CONTEXT = - (val_prev >> params.val1_shift) & params.val1_context_mask; - for (uint32_t cc = 0; cc < nLineBytes; cc++) { - if (is_second_line) { - val_prev = (val_prev << 8) | line_prev1_[cc + 1]; - } - uint8_t cVal = 0; - for (int32_t k = 7; k >= 0; k--) { - if (state->pArithDecoder->IsComplete()) { - return false; - } - - int bVal = state->pArithDecoder->Decode(&state->gbContexts[CONTEXT]); - cVal |= bVal << k; - CONTEXT = - ((CONTEXT & params.context_mask) << 1) | bVal | - ((val_prev >> (k + params.val1_shift)) & params.val1_bit_mask); - } - line_[cc] = cVal; - } - val_prev <<= 8; - uint8_t cVal1 = 0; - for (uint32_t k = 0; k < nBitsLeft; k++) { - if (state->pArithDecoder->IsComplete()) { - return false; - } - - int bVal = state->pArithDecoder->Decode(&state->gbContexts[CONTEXT]); - cVal1 |= bVal << (7 - k); - CONTEXT = - ((CONTEXT & params.context_mask) << 1) | bVal | - ((val_prev >> (7 - k + params.val1_shift)) & params.val1_bit_mask); - } - line_[nLineBytes] = cVal1; - return true; - } - - uint32_t val_prev2 = line_prev2_[0] << params.val2_shift; - uint32_t val_prev1 = line_prev1_[0]; - uint32_t CONTEXT = - (val_prev2 & params.val2_context_mask) | - ((val_prev1 >> params.val1_shift) & params.val1_context_mask); - for (uint32_t cc = 0; cc < nLineBytes; cc++) { - val_prev2 = (val_prev2 << 8) | (line_prev2_[cc + 1] << params.val2_shift); - val_prev1 = (val_prev1 << 8) | line_prev1_[cc + 1]; - uint8_t cVal = 0; - for (int32_t k = 7; k >= 0; k--) { - if (state->pArithDecoder->IsComplete()) { - return false; - } - - int bVal = state->pArithDecoder->Decode(&state->gbContexts[CONTEXT]); - cVal |= bVal << k; - CONTEXT = ((CONTEXT & params.context_mask) << 1) | bVal | - ((val_prev2 >> k) & params.val2_bit_mask) | - ((val_prev1 >> (k + params.val1_shift)) & params.val1_bit_mask); - } - line_[cc] = cVal; - } - val_prev2 <<= 8; - val_prev1 <<= 8; - uint8_t cVal1 = 0; - for (uint32_t k = 0; k < nBitsLeft; k++) { - if (state->pArithDecoder->IsComplete()) { - return false; - } - - int bVal = state->pArithDecoder->Decode(&state->gbContexts[CONTEXT]); - cVal1 |= bVal << (7 - k); - CONTEXT = - ((CONTEXT & params.context_mask) << 1) | bVal | - ((val_prev2 >> (7 - k)) & params.val2_bit_mask) | - ((val_prev1 >> (7 - k + params.val1_shift)) & params.val1_bit_mask); - } - line_[nLineBytes] = cVal1; - return true; -} - FXCODEC_STATUS CJBig2_GRDProc::ProgressiveDecodeArithTemplate2Unopt( ProgressiveArithDecodeState* pState) { CJBig2_Image* pImage = pState->pImage->get(); @@ -1001,97 +817,6 @@ FXCODEC_STATUS CJBig2_GRDProc::ProgressiveDecodeArithTemplate2Unopt( return FXCODEC_STATUS::kDecodeFinished; } -FXCODEC_STATUS CJBig2_GRDProc::ProgressiveDecodeArithTemplate3Opt3( - ProgressiveArithDecodeState* pState) { - CJBig2_Image* pImage = pState->pImage->get(); - pdfium::span gbContexts = pState->gbContexts; - CJBig2_ArithDecoder* pArithDecoder = pState->pArithDecoder; - if (line_.empty()) { - line_ = pImage->span(); - } - - const LineLayout layout = GetLineLayout(GBW); - for (; loop_index_ < GBH; loop_index_++) { - if (TPGDON) { - if (pArithDecoder->IsComplete()) { - return FXCODEC_STATUS::kError; - } - - ltp_ = ltp_ ^ pArithDecoder->Decode(&gbContexts[0x0195]); - } - if (ltp_) { - CopyPrevLine(pImage); - } else { - if (loop_index_ == 0) { - uint32_t CONTEXT = 0; - for (uint32_t cc = 0; cc < layout.full_bytes; cc++) { - uint8_t cVal = 0; - for (int32_t k = 7; k >= 0; k--) { - if (pArithDecoder->IsComplete()) { - return FXCODEC_STATUS::kError; - } - - int bVal = pArithDecoder->Decode(&gbContexts[CONTEXT]); - cVal |= bVal << k; - CONTEXT = ((CONTEXT & 0x01f7) << 1) | bVal; - } - line_[cc] = cVal; - } - uint8_t cVal1 = 0; - for (uint32_t k = 0; k < layout.last_byte_bits; k++) { - if (pArithDecoder->IsComplete()) { - return FXCODEC_STATUS::kError; - } - - int bVal = pArithDecoder->Decode(&gbContexts[CONTEXT]); - cVal1 |= bVal << (7 - k); - CONTEXT = ((CONTEXT & 0x01f7) << 1) | bVal; - } - line_[layout.full_bytes] = cVal1; - } else { - uint32_t val_prev = line_prev1_[0]; - uint32_t CONTEXT = (val_prev >> 1) & 0x03f0; - for (uint32_t cc = 0; cc < layout.full_bytes; cc++) { - val_prev = (val_prev << 8) | line_prev1_[cc + 1]; - uint8_t cVal = 0; - for (int32_t k = 7; k >= 0; k--) { - if (pArithDecoder->IsComplete()) { - return FXCODEC_STATUS::kError; - } - - int bVal = pArithDecoder->Decode(&gbContexts[CONTEXT]); - cVal |= bVal << k; - CONTEXT = ((CONTEXT & 0x01f7) << 1) | bVal | - ((val_prev >> (k + 1)) & 0x0010); - } - line_[cc] = cVal; - } - val_prev <<= 8; - uint8_t cVal1 = 0; - for (uint32_t k = 0; k < layout.last_byte_bits; k++) { - if (pArithDecoder->IsComplete()) { - return FXCODEC_STATUS::kError; - } - - int bVal = pArithDecoder->Decode(&gbContexts[CONTEXT]); - cVal1 |= bVal << (7 - k); - CONTEXT = ((CONTEXT & 0x01f7) << 1) | bVal | - ((val_prev >> (8 - k)) & 0x0010); - } - line_[layout.full_bytes] = cVal1; - } - } - AdvanceLine(pImage); - if (pState->pPause && pState->pPause->NeedToPauseNow()) { - loop_index_++; - progressive_status_ = FXCODEC_STATUS::kDecodeToBeContinued; - return FXCODEC_STATUS::kDecodeToBeContinued; - } - } - progressive_status_ = FXCODEC_STATUS::kDecodeFinished; - return FXCODEC_STATUS::kDecodeFinished; -} - FXCODEC_STATUS CJBig2_GRDProc::ProgressiveDecodeArithTemplate3Unopt( ProgressiveArithDecodeState* pState) { CJBig2_Image* pImage = pState->pImage->get(); diff --git a/core/fxcodec/jbig2/jbig2_grd_proc.h b/core/fxcodec/jbig2/jbig2_grd_proc.h index 48be463a5..c95c1a8a8 100644 --- a/core/fxcodec/jbig2/jbig2_grd_proc.h +++ b/core/fxcodec/jbig2/jbig2_grd_proc.h @@ -62,49 +62,29 @@ class CJBig2_GRDProc { std::array GBAT; private: - struct TemplateOpt3Params { - uint32_t tp_ctx; - uint32_t context_mask; - int val1_shift; - uint32_t val1_context_mask; - uint32_t val1_bit_mask; - int val2_shift; - uint32_t val2_context_mask; - uint32_t val2_bit_mask; - }; - bool UseTemplate0Opt3() const; bool UseTemplate1Opt3() const; bool UseTemplate23Opt3() const; FXCODEC_STATUS ProgressiveDecodeArith(ProgressiveArithDecodeState* pState); - FXCODEC_STATUS ProgressiveDecodeArithTemplate0Opt3( - ProgressiveArithDecodeState* pState); FXCODEC_STATUS ProgressiveDecodeArithTemplate0Unopt( ProgressiveArithDecodeState* pState); - FXCODEC_STATUS ProgressiveDecodeArithTemplate1Opt3( - ProgressiveArithDecodeState* pState); FXCODEC_STATUS ProgressiveDecodeArithTemplate1Unopt( ProgressiveArithDecodeState* pState); - FXCODEC_STATUS ProgressiveDecodeArithTemplate2Opt3( - ProgressiveArithDecodeState* pState); FXCODEC_STATUS ProgressiveDecodeArithTemplate2Unopt( ProgressiveArithDecodeState* pState); - FXCODEC_STATUS ProgressiveDecodeArithTemplate3Opt3( - ProgressiveArithDecodeState* pState); FXCODEC_STATUS ProgressiveDecodeArithTemplate3Unopt( ProgressiveArithDecodeState* pState); - bool ProgressiveDecodeArithTemplateOpt3Helper( - ProgressiveArithDecodeState* state, - const TemplateOpt3Params& params, - uint32_t nLineBytes, - uint32_t nBitsLeft); + // The decoders for the nominal AT pixel positions of each template. + template + FXCODEC_STATUS ProgressiveDecodeArithOpt3( + ProgressiveArithDecodeState* pState); void AdvanceLine(const CJBig2_Image* image); void CopyPrevLine(CJBig2_Image* image); - template + template std::unique_ptr DecodeArithOpt3( CJBig2_ArithDecoder* pArithDecoder, pdfium::span gbContexts); @@ -112,9 +92,6 @@ class CJBig2_GRDProc { std::unique_ptr DecodeArithTemplateUnopt( CJBig2_ArithDecoder* pArithDecoder, pdfium::span gbContexts); - std::unique_ptr DecodeArithTemplate3Opt3( - CJBig2_ArithDecoder* pArithDecoder, - pdfium::span gbContexts); std::unique_ptr DecodeArithTemplate3Unopt( CJBig2_ArithDecoder* pArithDecoder, pdfium::span gbContexts); From 2f366eae34dfecae3265b88eed906d21688407ca Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Wed, 2 Dec 2026 11:20:06 -0800 Subject: [PATCH 15/15] Implement CJBig2_GRDProc::DecodeArith using the progressive decoder This saves a bunch more duplicated code. DecodeArith is called for symbols, so this moves symbol decoding to use the progressive decoder. Since the progressive decoder has to set up some state in member variable spans, there's some more overhead per symbol. On regular files, this increases instructions run by 1-3%, but it costs no actual time. On synthetic worst-case-for-this-patch inputs (bitmap-symbol-manysyms.pdf, 260K symbols that are 9x2 pixels), this costs 12% more instructions and 5-10% more cycles. The next commit will save 2-50% of cycles for regular files, so I think the code sharing makes it worth it. Example measurements (ARM64 macOS, best of 3 interleaved runs): IBM 4860 (PCjr) - Technical Reference.pdf --pages=0 (608 symbol dictionaries): 0.85 s -> 0.86 s, 3.44 G -> 3.46 G cycles Wheeling.VA.Daily.Intelligencer.1880.12.11889.pdf: 1.55 s -> 1.54 s (I benchmarked many more files.) No behavior change. Bug: 584665243 Change-Id: I1367d2d5efeeebc36d847ab0fbdae2881498e331 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/166010 Reviewed-by: Lei Zhang Reviewed-by: Nico Weber Auto-Submit: Nico Weber Commit-Queue: Nico Weber --- core/fxcodec/jbig2/jbig2_grd_proc.cpp | 236 ++------------------------ core/fxcodec/jbig2/jbig2_grd_proc.h | 12 -- 2 files changed, 14 insertions(+), 234 deletions(-) diff --git a/core/fxcodec/jbig2/jbig2_grd_proc.cpp b/core/fxcodec/jbig2/jbig2_grd_proc.cpp index afeea70c5..099fa7332 100644 --- a/core/fxcodec/jbig2/jbig2_grd_proc.cpp +++ b/core/fxcodec/jbig2/jbig2_grd_proc.cpp @@ -7,7 +7,6 @@ #include "core/fxcodec/jbig2/jbig2_grd_proc.h" #include -#include #include #include @@ -21,17 +20,6 @@ namespace { -// TODO(crbug.com/567627774): Name this constants better or merge some together. -// They are only used by DecodeArithTemplateUnopt(). -constexpr std::array kOptConstant9 = { - {0x000c, 0x0009, 0x0007}}; -constexpr std::array kOptConstant10 = { - {0x0007, 0x000f, 0x0007}}; -constexpr std::array kOptConstant11 = { - {0x001f, 0x001f, 0x000f}}; -constexpr std::array kOptConstant12 = { - {0x000f, 0x0007, 0x0003}}; - // The generic region templates (6.2.5.3), for the optimized decoders that // handle the nominal AT pixel positions. template @@ -106,8 +94,8 @@ struct LineLayout { uint32_t last_byte_bits; }; -// Decode row `row` of an optimized generic region into `line`. `prev1` and -// `prev2` are the two rows above it. Returns false if data runs out. +// `prev1` and `prev2` are the two rows above `row`. +// Returns false if data runs out. template bool DecodeOpt3Row(CJBig2_ArithDecoder* decoder, pdfium::span contexts, @@ -240,213 +228,17 @@ std::unique_ptr CJBig2_GRDProc::DecodeArith( return std::make_unique(GBW, GBH); } - switch (GBTEMPLATE) { - case 0: - return UseTemplate0Opt3() - ? DecodeArithOpt3<0>(pArithDecoder, gbContexts) - : DecodeArithTemplateUnopt<0>(pArithDecoder, gbContexts); - case 1: - return UseTemplate1Opt3() - ? DecodeArithOpt3<1>(pArithDecoder, gbContexts) - : DecodeArithTemplateUnopt<1>(pArithDecoder, gbContexts); - case 2: - return UseTemplate23Opt3() - ? DecodeArithOpt3<2>(pArithDecoder, gbContexts) - : DecodeArithTemplateUnopt<2>(pArithDecoder, gbContexts); - default: - return UseTemplate23Opt3() - ? DecodeArithOpt3<3>(pArithDecoder, gbContexts) - : DecodeArithTemplate3Unopt(pArithDecoder, gbContexts); - } -} - -template -std::unique_ptr CJBig2_GRDProc::DecodeArithOpt3( - CJBig2_ArithDecoder* pArithDecoder, - pdfium::span gbContexts) { - using Traits = TemplateTraits; - auto GBREG = std::make_unique(GBW, GBH); - if (!GBREG->has_data()) { - return nullptr; - } - - int LTP = 0; - const LineLayout layout = GetLineLayout(GBW); - const uint32_t height = Traits::kTrimHeight ? GBH & 0x7fffffff : GBH; - pdfium::span row_write; - pdfium::span row_prev1; - pdfium::span row_prev2; - for (uint32_t h = 0; h < height; ++h) { - row_prev2 = row_prev1; - row_prev1 = row_write; - row_write = GBREG->GetLine(h); - if (TPGDON) { - if (pArithDecoder->IsComplete()) { - return nullptr; - } - - LTP = LTP ^ pArithDecoder->Decode(&gbContexts[Traits::kTpContext]); - if (LTP) { - GBREG->CopyLine(row_write, row_prev1); - continue; - } - } - if (!DecodeOpt3Row(pArithDecoder, gbContexts, h, row_prev2, - row_prev1, row_write, layout)) { - return nullptr; - } - } - return GBREG; -} - -template -std::unique_ptr CJBig2_GRDProc::DecodeArithTemplateUnopt( - CJBig2_ArithDecoder* pArithDecoder, - pdfium::span gbContexts) { - auto GBREG = std::make_unique(GBW, GBH); - if (!GBREG->has_data()) { - return nullptr; - } - - GBREG->Fill(false); - int LTP = 0; - const uint8_t MOD2 = UNOPT % 2; - const uint8_t DIV2 = UNOPT / 2; - const uint8_t SHIFT = 4 - UNOPT; - pdfium::span row_write; - pdfium::span row_prev1; - pdfium::span row_prev2; - for (uint32_t h = 0; h < GBH; h++) { - row_prev2 = row_prev1; - row_prev1 = row_write; - row_write = GBREG->GetLine(h); - if (TPGDON) { - if (pArithDecoder->IsComplete()) { - return nullptr; - } - - LTP = LTP ^ pArithDecoder->Decode( - &gbContexts[TemplateTraits::kTpContext]); - if (LTP) { - GBREG->CopyLine(row_write, row_prev1); - continue; - } - } - - pdfium::span row_skip; - if (USESKIP) { - row_skip = SKIP->GetLine(h); - } - pdfium::span row_gbat0 = GBREG->GetLine(h + GBAT[1]); - pdfium::span row_gbat1; - pdfium::span row_gbat2; - pdfium::span row_gbat3; - if (UNOPT == 0) { - row_gbat1 = GBREG->GetLine(h + GBAT[3]); - row_gbat2 = GBREG->GetLine(h + GBAT[5]); - row_gbat3 = GBREG->GetLine(h + GBAT[7]); - } - - uint32_t val_prev2 = GBREG->GetPixel(1 + MOD2, row_prev2); - val_prev2 |= GBREG->GetPixel(MOD2, row_prev2) << 1; - if (UNOPT == 1) { - val_prev2 |= GBREG->GetPixel(0, row_prev2) << 2; - } - uint32_t val_prev1 = GBREG->GetPixel(2 - DIV2, row_prev1); - val_prev1 |= GBREG->GetPixel(1 - DIV2, row_prev1) << 1; - if (UNOPT < 2) { - val_prev1 |= GBREG->GetPixel(0, row_prev1) << 2; - } - uint32_t val_current = 0; - for (uint32_t w = 0; w < GBW; w++) { - int bVal = 0; - if (!USESKIP || !SKIP->GetPixel(w, row_skip)) { - if (pArithDecoder->IsComplete()) { - return nullptr; - } - - uint32_t CONTEXT = val_current; - CONTEXT |= GBREG->GetPixel(w + GBAT[0], row_gbat0) << SHIFT; - CONTEXT |= val_prev1 << (SHIFT + 1); - CONTEXT |= val_prev2 << kOptConstant9[UNOPT]; - if (UNOPT == 0) { - CONTEXT |= GBREG->GetPixel(w + GBAT[2], row_gbat1) << 10; - CONTEXT |= GBREG->GetPixel(w + GBAT[4], row_gbat2) << 11; - CONTEXT |= GBREG->GetPixel(w + GBAT[6], row_gbat3) << 15; - } - bVal = pArithDecoder->Decode(&gbContexts[CONTEXT]); - if (bVal) { - GBREG->SetPixel(w, row_write, bVal); - } - } - val_prev2 = - ((val_prev2 << 1) | GBREG->GetPixel(w + 2 + MOD2, row_prev2)) & - kOptConstant10[UNOPT]; - val_prev1 = - ((val_prev1 << 1) | GBREG->GetPixel(w + 3 - DIV2, row_prev1)) & - kOptConstant11[UNOPT]; - val_current = ((val_current << 1) | bVal) & kOptConstant12[UNOPT]; - } - } - return GBREG; -} - -std::unique_ptr CJBig2_GRDProc::DecodeArithTemplate3Unopt( - CJBig2_ArithDecoder* pArithDecoder, - pdfium::span gbContexts) { - auto GBREG = std::make_unique(GBW, GBH); - if (!GBREG->has_data()) { + std::unique_ptr image; + ProgressiveArithDecodeState state; + state.pImage = ℑ + state.pArithDecoder = pArithDecoder; + state.gbContexts = gbContexts; + const FXCODEC_STATUS status = StartDecodeArith(&state); + FinishDecode(); + if (status != FXCODEC_STATUS::kDecodeFinished) { return nullptr; } - - GBREG->Fill(false); - int LTP = 0; - pdfium::span row_write; - pdfium::span row_prev; - for (uint32_t h = 0; h < GBH; h++) { - row_prev = row_write; - row_write = GBREG->GetLine(h); - if (TPGDON) { - if (pArithDecoder->IsComplete()) { - return nullptr; - } - - LTP = LTP ^ pArithDecoder->Decode(&gbContexts[0x0195]); - if (LTP) { - GBREG->CopyLine(row_write, row_prev); - continue; - } - } - - pdfium::span row_skip; - if (USESKIP) { - row_skip = SKIP->GetLine(h); - } - pdfium::span row_gbat = GBREG->GetLine(h + GBAT[1]); - - uint32_t val_prev = GBREG->GetPixel(1, row_prev); - val_prev |= GBREG->GetPixel(0, row_prev) << 1; - uint32_t val_current = 0; - for (uint32_t w = 0; w < GBW; w++) { - int bVal = 0; - if (!USESKIP || !SKIP->GetPixel(w, row_skip)) { - uint32_t CONTEXT = val_current; - CONTEXT |= GBREG->GetPixel(w + GBAT[0], row_gbat) << 4; - CONTEXT |= val_prev << 5; - if (pArithDecoder->IsComplete()) { - return nullptr; - } - - bVal = pArithDecoder->Decode(&gbContexts[CONTEXT]); - } - if (bVal) { - GBREG->SetPixel(w, row_write, bVal); - } - val_prev = ((val_prev << 1) | GBREG->GetPixel(w + 2, row_prev)) & 0x1f; - val_current = ((val_current << 1) | bVal) & 0x0f; - } - } - return GBREG; + return image; } FXCODEC_STATUS CJBig2_GRDProc::StartDecodeArith( @@ -479,8 +271,8 @@ FXCODEC_STATUS CJBig2_GRDProc::ProgressiveDecodeArith( ProgressiveArithDecodeState* pState) { int iline = loop_index_; - using DecodeFunction = std::function; + using DecodeFunction = + FXCODEC_STATUS (CJBig2_GRDProc::*)(ProgressiveArithDecodeState*); DecodeFunction func; switch (GBTEMPLATE) { case 0: @@ -505,7 +297,7 @@ FXCODEC_STATUS CJBig2_GRDProc::ProgressiveDecodeArith( break; } CJBig2_Image* pImage = pState->pImage->get(); - progressive_status_ = func(*this, pState); + progressive_status_ = (this->*func)(pState); replace_rect_.left = 0; replace_rect_.right = pImage->width(); replace_rect_.top = iline; diff --git a/core/fxcodec/jbig2/jbig2_grd_proc.h b/core/fxcodec/jbig2/jbig2_grd_proc.h index c95c1a8a8..0105e3e57 100644 --- a/core/fxcodec/jbig2/jbig2_grd_proc.h +++ b/core/fxcodec/jbig2/jbig2_grd_proc.h @@ -84,18 +84,6 @@ class CJBig2_GRDProc { void AdvanceLine(const CJBig2_Image* image); void CopyPrevLine(CJBig2_Image* image); - template - std::unique_ptr DecodeArithOpt3( - CJBig2_ArithDecoder* pArithDecoder, - pdfium::span gbContexts); - template - std::unique_ptr DecodeArithTemplateUnopt( - CJBig2_ArithDecoder* pArithDecoder, - pdfium::span gbContexts); - std::unique_ptr DecodeArithTemplate3Unopt( - CJBig2_ArithDecoder* pArithDecoder, - pdfium::span gbContexts); - uint32_t loop_index_ = 0; pdfium::raw_span line_prev2_; pdfium::raw_span line_prev1_;