Skip to content

Sync S8: merge upstream PDFium up to 3c9748bd6 (Sep 30 2026) - #71

Merged
bobsingor merged 155 commits into
embedpdf/mainfrom
embedpdf/sync/3c9748bd6
Oct 13, 2026
Merged

bobsingor merged 155 commits into
embedpdf/mainfrom
embedpdf/sync/3c9748bd6

Conversation

@bobsingor

Copy link
Copy Markdown
Contributor

No description provided.

April Kallmeyer and others added 30 commits September 1, 2026 13:23
Change-Id: If68cbb8024de3140c26512dd6b3ae5ff97bd3233
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/156590
Commit-Queue: Lei Zhang <thestig@chromium.org>
Auto-Submit: April Kallmeyer <ask@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: April Kallmeyer <ask@chromium.org>
The other changes are a copy of https://crrev.com/1676222
which updated a path and a condition used to obtain the ndk.

Change-Id: I11bd1d242c5965038e004803c912790aa9f09311
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/156610
Auto-Submit: April Kallmeyer <ask@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: April Kallmeyer <ask@chromium.org>
Global Mean Squared Error (MSE) and per-pixel delta thresholds in
image_diff can be overly restrictive on continuous-tone images (such
as JPEG decompressed outputs or anti-aliased gradients). Subpixel
inverse-DCT precision, chroma upsampling interpolation, and rounding
variations between integer and floating-point decoders produce small
delta clusters along high-contrast boundaries. While visually
imperceptible, these local variations exceed strict per-pixel delta
limits (delta <= 3).

Conversely, simply raising the global MSE threshold allows localized
defects in small page regions to go undetected.

To resolve this, introduce a sliding window Mean Squared Error
(CalculateMaxWindowMSE) using a 2D Summed-Area Table (Integral Image)
with O(1) evaluation per pixel. This enforces that no local sub-window
(default 8x8) exceeds a localized error density threshold, bounding
local distortion while tolerating continuous-tone rounding noise.

Extend the --fuzzy command-line flag and test suppressor to accept
positional parameters: --fuzzy[=delta,mse,win_mse].

This change introduces the differ infrastructure and unit tests
without altering existing test expectations or suppressions.

TAG=agy
CONV=1c2eb351-a6fc-4fe7-ab25-db1c71c96f52

Change-Id: Icd92b3cbd51616daa87f615240433e98086f198f
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/156190
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Update EmbedderTest comparison helpers to accept DiffOptions instead of
individual delta and MSE parameters as a mechanical refactoring without
behavioral changes.

-- Fold overload into a single form.

TAG=agy
CONV=2860a30e-1863-4ef5-b361-28d96ec73cb8

Change-Id: I9fc0b1f0903fdd1a2956cbd50c96ad608f4b40df
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/156650
Auto-Submit: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Update CompareBGRxBitmapToPng() in testing/embedder_test.cpp to delegate
to CalculatePixelsDifferent() and add unit tests covering exact and
fuzzy matching.

-- Make minor improvements in matching algorithm.

TAG=agy
CONV=2860a30e-1863-4ef5-b361-28d96ec73cb8

Change-Id: I5e20575bcc30bfc67757f54b73eafa27368b12af
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/156670
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Wire CalculateMaxWindowMSE into EmbedderTest's bitmap comparison
routines. When CompareBitmapWithFuzzyExpectationSuffix() is invoked,
it now checks max_window_mean_squared_error using kMaxFuzzyWindowSize
and kMaxFuzzyWindowMeanSquaredError from pixel_diff_util.h in addition
to per-pixel delta and global MSE.

This ensures embedder tests share the same localized defect rejection
capabilities as pdfium_diff. This will catch more fuzzy failures.

TAG=agy
CONV=75945a90-5be1-4c24-a2c4-402f00166910

Change-Id: I9287d092d264a3e9d380002ba69ef7b06f1d1b8b
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/156630
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
With the pre-existing code, invalid 1-D runs can eventually cause an
integer overflow. Check for invalid run length to return early and avoid
the integer overflow altogether.

Bug: 534431561
Change-Id: I0a5964ec41eab0d3b7c7741824a67fd76d0812f6
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/156450
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
This CL sets BROTLI_DECODER_PARAM_LARGE_WINDOW to 1 during decoder
initialization. This allows for greater compliance with the BrotliDecode
spec and allows for greater decode window sizes of up to 1GiB.

Bug: 550470373
Change-Id: I795d1b363a2977d3b1e7a1d9b03ea03dd1a4ee3b
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/155710
Auto-Submit: Aryan Krishnan <aryankrishnan4b@gmail.com>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Removes architectural bottlenecks for subsequent fontations work.

Allow pdf_enable_fontations=true in standalone AGG builds without
requiring pdf_use_skia=true. This enables safe Rust font table
parsing via Fontations (read-fonts and skrifa) while preserving
FreeType/AGG rasterization.

Also add frankenfonts.md proposal document outlining the hybrid
Rust font parsing and FreeType rasterization architecture. This CL
does not accomplish the end goal, however.

* Add --fontations flag support to pdfium_unittests

TAG=agy
CONV=db6cb163-190b-47d4-bbdc-b519626ce208

Bug: 42271123
Change-Id: I9abb1a76db071d984935ec47a65fd3431aacb0eb
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/156050
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Remove `has_rust_decoders` from Suppressor to enforce no fuzzy blankets
for Rust image decoders. Previously, the presence of any Rust decoder
feature triggered blanket fuzzy diff matching across all pixel and
corpus tests.

With the introduction of windowed MSE and custom fuzzy tolerances in
image_diff and SUPPRESSIONS_EXACT_MATCHING, lossless codecs (BMP, PNG,
and GIF) are held to bit-perfect exact matching by default. Tests with
acceptable decoder variances can now be selectively configured with
custom tolerances instead of blanket forgiveness.

TAG=agy
CONV=9efbb0e0-217e-442a-9ecd-2e81b0992eb8

Change-Id: I8ca79f42b3326618955183e75861ea63da1b8ef6
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/156710
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Also skip the test when running under AddressSanitizer in addition to
debug builds, as it is slow as well.

TAG=agy
CONV=0541f91c-f7f9-4e30-91c4-8f5dcbe5c90c

Change-Id: I62372265ceda1c4e00c92e1b9087714f29823202
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/156730
Reviewed-by: Lei Zhang <thestig@chromium.org>
Auto-Submit: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
In horizontal mode, FaxG4GetRow() decodes two 1-D runs. Invalid runs can
eventually cause an integer overflow when chained together. Bound the
run lengths against the row width to return early and avoid the integer
overflow altogether.

Also check if FaxGetRun() returns a negative value before adding to the
run length. This prevents adding -1 on unexpected EOF or invalid code
words, which previously caused the inner loop to terminate early as if
-1 were a terminating code.

Remove the now-redundant post-loop checks for negative run lengths.

TAG=agy
CONV=93b9333d-4e34-48a0-b2ef-349e9f00b040

Change-Id: Ie50964caea573880449cb6b6c476b09530df4f8d
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/156470
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
A run length in CCITT Group 3 and Group 4 fax encoding is inherently
non-negative and fits within uint16_t, as the maximum run in the lookup
tables is 2560. Returning std::optional<uint16_t> replaces the -1
sentinel value with std::nullopt.

Update callers in FaxG4GetRow() and FaxGet1DLine() to check for an
empty optional rather than a negative integer, preventing accidental
addition of -1 or treating -1 as a terminating code.

TAG=agy
CONV=93b9333d-4e34-48a0-b2ef-349e9f00b040

Change-Id: I4aa25905fb8189e22a97e5ff861f1483848b546b
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/156471
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
The 24-bit color scanlines provided to ProgressiveDecoder by both
the BMP decoders and LibjpegJpegContext (which performs an in-place
RGB2BGR conversion in ContinueDecode()) are arranged in BGR order
in memory.

Rename ProgressiveDecoderContextDelegate::Format::kRgb to Format::kBgr
to accurately reflect that the buffer is in BGR byte order. This is a
pure rename with zero behavior change, preparing for the introduction
of true RGB decoding. Then do the same for the other formats so
affected.

TAG=agy
CONV=0541f91c-f7f9-4e30-91c4-8f5dcbe5c90c

Change-Id: Ic1290c836a0f27236666ea984ca3b3de1939b00f
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/156790
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
IsLeapYear() previously inverted the 400-year exception, incorrectly
treating century years divisible by 400 (such as 2000) as common years
and non-leap century years (such as 1900) as leap years.

Correct the logic to treat years divisible by 400 as leap years and
other century years as common years.

Update test expectations for 11/12/2000 in
ParseDateUsingFormatForValidMonthDay to account for the leap day. Add
boundary test cases for 1900 and 2000 to GetYearFromTime and
GetMonthFromTime, and add a GetDayFromTime test.

TAG=agy
CONV=217915ef-20b8-4b6e-849b-8360d32c7229

Fixed: 555821585
Change-Id: I3722f459134e25b060d4a08fb5969986ae543aaf
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/156832
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Andy Phan <andyphan@chromium.org>
CJS_Util::printd() supports formatting dates with full and abbreviated
day of week ("dddd" and "ddd"). However, it never populated tm_wday in
the struct tm used to format the string, leaving it at 0. As a result,
CJS_Util::printd() always printed "Sunday" or "Sun" for any date.

Add FX_GetDayOfWeekFromTime() to calculate the day of the week
(0 = Sunday ... 6 = Saturday) per ECMAScript specifications, and use it
to set tm_wday in CJS_Util::printd().

TAG=agy
CONV=217915ef-20b8-4b6e-849b-8360d32c7229

Fixed: 555848529
Change-Id: Ia42e3f4ae814475cf5625c697effbf625e7b4f8e
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/156833
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Andy Phan <andyphan@chromium.org>
FX_ParseDateUsingFormat() previously added 2000 to all two-digit years
in [0, 99], mapping every two-digit year into the 2000-2099 range (e.g.,
"85" became 2085 and "95" became 2095).

Adobe Acrobat and pdf.js use a 50-year pivot (the Date Horizon rule)
where two-digit years 00-49 are mapped to 2000-2049, and 50-99 are
mapped to 1950-1999.

Apply Acrobat's 50-year pivot to two-digit year parsing in
FX_ParseDateUsingFormat().

TAG=agy
CONV=217915ef-20b8-4b6e-849b-8360d32c7229

Fixed: 555821586
Change-Id: I37c63a5baad132673064c57c3f463778b9c4be6f
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/156850
Commit-Queue: Andy Phan <andyphan@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Per ISO 32000-1 section 10.3 and Table 58, transfer functions (/TR) must
map input color component values in [0.0, 1.0] to output values also in
the range [0.0, 1.0]. While PDF functions generally (section 7.10) can
declare a /Range outside [0.0, 1.0] for shading patterns or color
spaces, transfer functions modulate device color channels directly.

When populating the 256-entry lookup table in CreateTransferFunc() and
LoadSMask(), unclamped float outputs were rounded and converted to
uint8_t. Any function outputting values outside [0.0, 1.0] (such as a
Type 4 PostScript calculator function with /Range [-1 1]) wrapped modulo
256, producing inverted colors (e.g. -0.5 wrapped to 128 instead of
saturating at 0).

Clamp the rounded sample values to [0, 255] before storing them in the
lookup table. This does not affect general function evaluation in
CPDF_Function::Call(), so functions requiring /Range outside [0.0, 1.0]
for shadings and color spaces continue to evaluate without restriction.
Also add a unit test covering out-of-range transfer functions and update
the existing test expectations that asserted the unclamped wrapped
values.

TAG=agy
CONV=6c24f844-e095-4a12-a6ae-19ea09a39475

Fixed: 555967331
Change-Id: I610f5e1869d3e6dc525e7010ac3429d1901dd308
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/156830
Commit-Queue: Andy Phan <andyphan@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Per ISO 32000-1 Table 58, when the /TR transfer function entry in an
ExtGState dictionary is an array of functions, the elements correspond
to the process colorants in order: Red, Green, Blue, (Gray), or Cyan,
Magenta, Yellow, Black.

In CreateTransferFunc(), the array was loaded into pFuncs using
pFuncs[2 - i] = Load(array[i]), loading array element 0 into pFuncs[2]
and array element 2 into pFuncs[0]. Downstream, pFuncs[0] populates
samples_r and pFuncs[2] populates samples_b. This transposed the Red and
Blue channels. The reversal originated from confusing physical BGR DIB
scanline layouts with logical channel indices, and existing unit test
expectations were written to match the reversed behavior.

Load the transfer function array in forward order so element 0 modulates
Red and element 2 modulates Blue. Reorder the test sample definitions
and update unit test expectations in CPDFDocRenderDataTest to reflect
the corrected channel mappings.

TAG=agy
CONV=6c24f844-e095-4a12-a6ae-19ea09a39475

Fixed: 555940409
Change-Id: I0ea622db48f7bed0d61a445d015891f2d25c1b9f
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/156831
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Andy Phan <andyphan@chromium.org>
When pdf_enable_rust_jpeg is set, JPEG decoding previously attempted
to delegate to Skia's SkJpegDecoder wrapper. However, Skia's wrapper
required pdf_use_skia, lacked direct Rust JPEG FFI bindings, and
failed for 4-component (CMYK/YCCK) JPEGs, causing decoding to fall back
to the C++ libjpeg implementation.

This change introduces RustScanlineDecoder and RustJpegContext, which
directly invoke the zune-jpeg Rust crate via CXX bridge FFI
(rust_jpeg_ffi). This enables native Rust JPEG decoding for 1, 3, and
4-component (CMYK and YCCK) images, and removes the dependency on
pdf_use_skia for Rust JPEG decoding.

The obsolete skia_jpeg_context and skia_scanline_decoder implementation
files have been removed. Continuous-tone JPEG test tolerances under
Skia and embedder test expectations have been updated to accommodate
minor IDCT rounding and chroma upsampling differences in zune-jpeg.

TAG=agy
CONV=873eda5c-74cd-479c-b5f1-24997eba2b24

Change-Id: I7fe24d45c8558cb64c5bc6acc0128d0ce242c434
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/155570
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Every neighbor is read through GetLeftValue() / GetUpValue() /
GetUpperLeftValue(), each of which does a span bounds check plus an
`i >= bytes_per_pixel` or `empty()` branch, per byte and per filter.

Size the row views once up front and hoist the two special cases out
of the loops: the first bytes_per_pixel bytes of a row, where the left
and upper-left neighbors are zero, and the first row of the image,
where up and upper-left are zero. On the first row the Paeth predictor
always selects the left neighbor and on the lead bytes it always
selects up, so those reduce to the Sub and Up filters. The Up filter
walks its three rows with fxcrt::Zip(), as do the lead bytes of the
Average and Paeth filters.

The Sub filter gets dedicated loops for 3- and 4-byte pixels that walk
the row as fixed-size pixel structs and carry each byte channel in a
local. Its channels form independent additive chains, and the generic
loop re-reads dest_span[i - bpp] a few iterations after storing it,
which serializes on store-to-load forwarding.

Bug: 549230311
Change-Id: I97629d99f412c2d93bf7961aec00a93bd4d90ac8
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/155510
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Clean up legacy Hungarian notation and single-letter variable names to
follow the style guide. Also use pre-increments and const consistently.

This is a pure refactoring with no behavioral changes.

TAG=agy
CONV=f96089b4-cb0a-43a3-8bf4-16d4c0790cb3

Bug: 555848528
Change-Id: Ic47035b5d3a4ac9b60e1907a8634bd3ee02ffc3f
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/156910
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Andy Phan <andyphan@chromium.org>
Replace cascading lookahead checks with direct token length counting:
- Previously, token lengths 1 to 4 were determined by cascading
  lookahead conditions with duplicated switch statements for each
  length.
- Count consecutive identical format characters up front to determine
  token length directly.
- Group lengths 1 and 2 together, since month, day, hour, minute, and
  second tokens share identical up-to-2-digit integer parsing logic.
  Only year ('y' vs 'yy') and AM/PM ('t' vs 'tt') require length checks.

This is a pure refactoring with no behavioral changes.

TAG=agy
CONV=f96089b4-cb0a-43a3-8bf4-16d4c0790cb3

Bug: 555848528
Change-Id: I5ae5017f5a90829e55ccba5579ab7c29f0a9aba8
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/156911
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Andy Phan <andyphan@chromium.org>
The motivation is that I'd like to optimize the huffman symbol
reading loop that's currently repeated in
1. CJBig2_HuffmanDecoder::DecodeAValue()
2. CJBig2_Context::DecodeSymbolIDHuffmanTable() (for reading `runcode`)
3. CJBig2_TRDProc::DecodeHuffman() (for reading `IDI`)

I mostly care about optimizing the last one, but it seems nicer to
dedupe them first.

This implements the 2nd in terms of the 1st; the 3rd is for a future CL.

* ParseFromStandardTable() becomes ParseFromTable() and receives
  a HuffmanTable instead of an index. This simplifies the
  CJBig2_HuffmanTable(int) constructor a bit, which used to
  load each built-in table in the ctor, and then again in
  ParseFromStandardTable(). This requires moving `struct HuffmanTable`
  to the header. (It's still an internal type, but as it's used by
  private functions, we have to move it over. If we wanted, we could
  put it inside the class, in the `private:` section.)

* Add a constructor that builds a CJBig2_HuffmanTable from just
  code lengths.

* Call that from CJBig2_Context::DecodeSymbolIDHuffmanTable()

While here, add a comment over `lines`, and fix
`RANDELEN` -> `RANGELEN` typo.

No intended behavior change.

(Linked bug vaguely related: I want to bump some limit, but things
are currently very slow with high symbol count, even with the current
limit.)

Bug: 555145149
Change-Id: If29d5d11951a47cf7b32f61d6147054f3fffd684
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/156810
Commit-Queue: Nico Weber <thakis@chromium.org>
Reviewed-by: Nico Weber <thakis@google.com>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
https://chromium.googlesource.com/chromium/src/third_party/zlib.git/+log/c5cc9edf8992..285e94b8fa95

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/zlib-pdfium
Please CC akall@google.com,thestig@chromium.org 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
Tbr: akall@google.com
Change-Id: I92895061d92445e2d0da2f2cb23c712efe552eba
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/157090
Bot-Commit: pdfium-autoroll@skia-public.iam.gserviceaccount.com <pdfium-autoroll@skia-public.iam.gserviceaccount.com>
Commit-Queue: pdfium-autoroll@skia-public.iam.gserviceaccount.com <pdfium-autoroll@skia-public.iam.gserviceaccount.com>
Passive FFI callbacks (e.g. FFI_OutputSelectedRect, FFI_Invalidate)
are notifications invoked during internal operations such as painting.
Embedders must not re-entrantly execute form actions or load/close
pages during these callbacks.

Track passive callbacks using CPDFSDK_FormFillEnvironment's
in_passive_ffi_callback_ flag, and early-return from entry points
such as FORM_OnAfterLoadPage, FORM_OnBeforeClosePage, and
FORM_Do*Action when invoked re-entrantly.

Active retrieval callbacks such as FFI_GetPage remain unflagged, as
page loading is expected in those paths.

TAG=agy
CONV=9e87637a-cb01-4106-9c04-ad4da437fc61

Bug: 556535630
Change-Id: Id892141ce082cc8895b4ed5dc66af3edaf5ef740
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/156913
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
These checks were temporary debugging scaffolding to verify parity
between FreeType and Skia/Fontations, but are now obsolete and
divergent on edge cases. Eliminating them simplifies CFX_Face methods
to direct return statements and removes unused Skia header inclusions.

Change-Id: I6d03431be951ee856bd2dcde3dcfdb0d115a3183
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/156970
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
In opj_j2k_copy_default_tcp_and_create_tcd(), copy m_nb_mcc_records
from the default tile coding parameters along with m_nb_max_mcc_records.

TAG=agy
CONV=a534277b-a66b-488e-ab0a-8833cb8e63ea

Bug: 541707261
Change-Id: Ic9b58719dd662e067751e141782d629e93149bc6
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/157011
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
…ions"

This reverts commit a0a39c3.

Reason for revert: Reverted too much code.

Original change's description:
> Remove PDF_ENABLE_SKIA_TYPEFACE_CHECKS and dead parity assertions
>
> These checks were temporary debugging scaffolding to verify parity
> between FreeType and Skia/Fontations, but are now obsolete and
> divergent on edge cases. Eliminating them simplifies CFX_Face methods
> to direct return statements and removes unused Skia header inclusions.
>
> Change-Id: I6d03431be951ee856bd2dcde3dcfdb0d115a3183
> Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/156970
> Reviewed-by: Lei Zhang <thestig@chromium.org>
> Commit-Queue: Tom Sepez <tsepez@chromium.org>

TBR=thestig@chromium.org,tsepez@chromium.org,pdfium-scoped@luci-project-accounts.iam.gserviceaccount.com

No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Change-Id: I587788e995165d887e7d9c95aadb3976102c79c3
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/157111
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Avoid ignoring fatal errors during Windows JPEG compression by using
longjmp to catch failures in libjpeg C wrapper functions, matching the
decompression architecture.

-- use modern memory ownership model.
-- avoid array of [1].

TAG=agy
CONV=2e125a78-6471-43e2-9eed-d2106f60cbec

Bug: 556853443
Change-Id: I2e5eadc41d277f2098ebc91be91d67578c10301f
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/157030
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
tsepez and others added 28 commits September 25, 2026 11:50
Allow CFX_Face creation without FreeType when using the Fontations
backend for Type 1 fonts, skipping FT_FaceRec allocation and
initialization.

Handle Type 1 character mapping, encoding selection, glyph index
lookup, and glyph path generation directly via Skrifa when FT_FaceRec
is null, while preserving FT_CharMap handling for SFNT faces that
still retain an FT_FaceRec. Guard all remaining FT_FaceRec accesses in
CFX_Face against null and add unit test coverage for faceless Type 1
glyph paths and bitmap rasterization.

-- Move Adobe Glyph List name and unicode conversions into cfx_face.cpp
-- Suppress one test which will fail under the new mode until the
   follow-on CL implements LCD-like filtering.

TAG=agy
CONV=bfb4bf1b-47cc-4055-aafa-26a5312d81ea

Bug: 42271123
Change-Id: I947c6f0734e42fe8a3e7d31c0cffa4b04469489a
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/158611
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
When rasterizing glyphs via `FT_Outline_Get_Bitmap()` in the stateless
Fontations path (where `FT_FaceRec` is null), the code does not apply
the LCD bounding-box padding or the 5-tap subpixel filter that
`FT_Render_Glyph()` normally performs for `FT_RENDER_MODE_LCD`.

Expand the horizontal bounding box by 2/3 of a pixel (128 units in 3x
26.6 fixed-point) on each side before rasterization and apply the
5-tap `FT_LCD_FILTER_DEFAULT` weights across each output scanline
afterwards.

Adjust the example_065.pdf fontations entry in testing/SUPPRESSION,
better rounding in the new code has moved an edge.

Bug: 42271123
Change-Id: Id4f30ab5c49413139efd0967ed8dc4e96c640a94
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/158810
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Add CFXFontMapperSystemFontInfoTest.GetCachedTTCFaceWithLargeTtc to test
CFX_FontMapper::GetCachedTTCFace() when the TTC data size exceeds the
1024-byte buffer in CFX_FontMapper::GetChecksumFromTT(). Disable the
test on MSAN builds for now, as GetChecksumFromTT() reads from an
uninitialized buffer when GetFontData() does not fill it.

TAG=agy
CONV=059f2a05-d124-4d35-b1e3-144227fa7db5

Bug: 565837689
Change-Id: Ia1e7823c663dd2058f777003624a7016f6be6f96
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/158730
Reviewed-by: Andy Phan <andyphan@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Previously, CFX_FontMapper::GetChecksumFromTT() passed an uninitialized
1024-byte stack buffer to SystemFontInfoIface::GetFontData(). When the
TTC data exceeded 1024 bytes, GetFontData() returned the required size
without writing to the buffer, causing GetChecksumFromTT() to compute a
checksum over uninitialized memory.

Fix this issue by reading the full `ttc_size` bytes once in
CFX_FontMapper::GetCachedTTCFace() and passing the resulting span to
GetChecksumFromTT(). This fixes the uninitialized memory read and
reduces the number of GetFontData() calls from 2 to 1. Since
GetChecksumFromTT() no longer calls GetFontData(), it can now live in
the anonymous namespace.

With the issue fixed, re-enable
CFXFontMapperSystemFontInfoTest.GetCachedTTCFaceWithLargeTtc in MSAN
builds.

Now that GetFontData() only gets called once, also adjust other existing
test cases to expect fewer GetFontData() calls.

TAG=agy
CONV=059f2a05-d124-4d35-b1e3-144227fa7db5
Bug: 565837689
Change-Id: Ifbe40ae1a1607d88d4f6099017297751d815ff65
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/158731
Reviewed-by: Andy Phan <andyphan@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
When multiple fuzzy lines in testing/SUPPRESSIONS match the same test,
Suppressor._LoadSuppressions() previously overwrote the entry in
exact_matching_suppression_dict on each match, causing the last matching
line in the file to win regardless of how many wildcards it contained.

Score each matching fuzzy rule's predicate columns (columns 1 through 5)
as a little-endian bitmask where '*' is 0 and any specific value is 1,
retaining the highest-scoring rule.

Re-order one line in testing/SUPPRESSIONS which failed under the old
order-of-appearance rules.

-- Narrow the scope of two other suppressions based upon the
   find_surprise_passes.py script.

Change-Id: Ic35aec79fe64294b37ed632b1fa4432b678d87a7
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/158830
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
https://chromium.googlesource.com/chromium/src/tools/code_coverage.git/+log/e1878fbb1ff7..a81032f8d6f5

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/code-coverage-pdfium
Please CC akall@google.com,dhoss@chromium.org,thestig@chromium.org 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
Tbr: akall@google.com
Change-Id: I7056991f2a1e36bcbf56b25a4afad21a47afe301
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/158931
Commit-Queue: pdfium-autoroll@skia-public.iam.gserviceaccount.com <pdfium-autoroll@skia-public.iam.gserviceaccount.com>
Bot-Commit: pdfium-autoroll@skia-public.iam.gserviceaccount.com <pdfium-autoroll@skia-public.iam.gserviceaccount.com>
https://chromium.googlesource.com/catapult.git/+log/50c971fc0958..7cce2c2359d9

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 akall@google.com,dhoss@chromium.org,thestig@chromium.org 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
Tbr: akall@google.com
Change-Id: If60f21ff411ef846be1eb87da01953b1e867b167
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/158930
Commit-Queue: pdfium-autoroll@skia-public.iam.gserviceaccount.com <pdfium-autoroll@skia-public.iam.gserviceaccount.com>
Bot-Commit: pdfium-autoroll@skia-public.iam.gserviceaccount.com <pdfium-autoroll@skia-public.iam.gserviceaccount.com>
This reverts commit db1b784.

Reason for revert: Culprit for tree closure

Failure Link: https://ci.chromium.org/ui/p/pdfium/builders/ci/win_xfa_asan/10568

Original change's description:
> Roll Catapult from 50c971fc0958 to 7cce2c2359d9 (12 revisions)
>
> https://chromium.googlesource.com/catapult.git/+log/50c971fc0958..7cce2c2359d9
>
> 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 akall@google.com,dhoss@chromium.org,thestig@chromium.org 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
> Tbr: akall@google.com
> Change-Id: If60f21ff411ef846be1eb87da01953b1e867b167
> Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/158930
> Commit-Queue: pdfium-autoroll@skia-public.iam.gserviceaccount.com <pdfium-autoroll@skia-public.iam.gserviceaccount.com>
> Bot-Commit: pdfium-autoroll@skia-public.iam.gserviceaccount.com <pdfium-autoroll@skia-public.iam.gserviceaccount.com>

TBR=pdfium-autoroll@skia-public.iam.gserviceaccount.com,pdfium-scoped@luci-project-accounts.iam.gserviceaccount.com,akall@google.com

No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: None
Change-Id: I34ca5b6e1230bbe068d5d9f7498d6ddc8dc49418
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/158970
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Aryan Krishnan <aryankrishnan4b@gmail.com>
Instead of iteratively calling PutArrayElementReentrant() on an empty
array, accumulate property names into a v8::LocalVector and instantiate
the v8::Array in a single call to v8::Array::New().

Bug: 566111382
Change-Id: I55f4718719cfa613f2c50a5dff10222b95a96c11
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/158890
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
This was the only location that included dragonbox.h, and the '#if'
style is similar to
https://pdfium-review.googlesource.com/c/pdfium/+/154490.

Change-Id: I58580a9283c64dba135f19af9a9325c04831e3af
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/158950
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Adjust expected LCD glyph width in TestType1Face from 18 to 24 to
account for 5-tap LCD filter padding. This test currently early-exits
on CQ because bots do not pass --fontations when running unittests,
but needs to be corrected before bots run unittests with the
Fontations backend.

Change-Id: I1505af87d046b34b502154a368052f1938a33c1e
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/159030
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Help to decouple FT and Fontations during tests.

Remove cross-backend FreeType usage from Skrifa unit tests. Compare
bounding boxes and font metadata directly against known constants
for static test fonts instead of querying FreeType at runtime.

Also remove GetFTFaceForTesting() from CFX_Face since this was its
sole consumer.

Change-Id: I7cbfb0e67a4ae75542dbd4f5c539fccc53070234
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/159050
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Migrate the legacy .vpython3 spec to vpython.toml and
vpython.toml.uv.lock, configure vpython_spec_files in
build_overrides/build.gni, and update testing/tools/BUILD.gn data to
reference the new specs.

Bug: 491263752
LSC: go/vpython-uv-config-lsc
TAG=agy
CONV=b53bdf70-37e7-4696-be50-8ee6fc19b1f8
Change-Id: Iadf2a05a373d031d33a5fdacf872b9d8fdd05038
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/158350
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Add Fontations implementations for CFX_Face::IsTtOt(), IsItalic(),
IsBold(), and GetBBox() when running in Fontations-only or minimal
FreeType configurations.

In CFX_Face::GetBBox(), invert the FT_FaceRec check so that the
dummy bounding box fallback remains at the end of the method.

Expose is_sfnt(), is_italic(), is_bold(), and font_bbox() across
the Skrifa CXX bridge to provide the underlying metrics from SFNT,
Type 1, and CFF font formats.

Bug: 42271123
Change-Id: Ie706c0d5961e819b820c4c23ac704bbdaff90065
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/158990
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Add an IsFontations() implementation to CFX_Face::GetCharBBox(). This
computes bounding boxes via GetGlyphBBox() and clamps them to the
face ascender and descender when IsTricky() is true, avoiding a null
pointer dereference on FT_FaceRec in Fontations-only mode. Also ensure
the FreeType fallback returns early if the face record is null.

Bug: 42271123
Change-Id: Ic7693d598a5fd6f58ac7d97bfe8b5c09fb50f6a0
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/159110
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
In a future where embedders may be enforcing the same unsafe checks
as in a standalone build, be sure to trigger a rebuild of pdfium-using
components if the unsafe buffers file changes.

Due to the infrequency with which this file change, land this
without worry of triggering extra chromium builds.

Bug: 565766512
Change-Id: I4557e50971a97622fd448b8afb021f0515906351
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/159070
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
npm@ is leaving, so remove them from the root OWNERS file and replace
TODO(npm) with TODO(crbug.com/...) pointing at newly filed bugs.

No functional changes.

Bug: 567626894, 567623562, 567621440, 567622442, 567626895, 567627774, 567626109
Change-Id: Id4f926858adf7da7e8f64013ed0488d96fa1cfe8
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/159150
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Nicolás Peña <npm@chromium.org>
Remove / replace inactive owner.

Change-Id: I1254ede1a1a0f1cfe996486cd0a9683ab36a4fe1
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/148894
Reviewed-by: Dominik Röttsches <drott@chromium.org>
Commit-Queue: Dominik Röttsches <drott@chromium.org>
Add an IsFontations() implementation to CFX_Face::GetSfntTable().
Expose a get_sfnt_table() method on skrifa::SkrifaFont via the CXX
bridge that retrieves SFNT table data using FontRef::table_data()
from read-fonts.

When an empty buffer is passed, the method returns the length of the
SFNT table (or 0 if missing/not an SFNT font). When a buffer is
provided, it copies the table bytes and returns the table length.

Bug: 42271123
Change-Id: I57170c972666fcf2f4a6f3bd348dd985d8b562dd
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/159130
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
This CL updates pdfium_test.cc to enable Brotli by default in the test
application. This CL also replaces the --enable-brotli test flag with
--disable-brotli due to it being enabled by default.

Bug: 475855993
Change-Id: I55ef3b5e1dda767c0ede9552fad6c83e94a42bfc
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/158010
Commit-Queue: Aryan Krishnan <aryankrishnan4b@gmail.com>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
When rendering text with large transformation matrix entries (such as
large c or d components that are not routed to DrawTextPath() by
CFX_RenderDevice::DrawNormalText()), multiplying the matrix entries by
10000 and casting float to int via static_cast<int> in UniqueKeyGen can
trigger float-cast-overflow undefined behavior.

Use pdfium::saturated_cast<int> instead of static_cast<int> when
computing the glyph cache key.

PiperOrigin-RevId: 991122773
Change-Id: Ie63f9ad396b6c85b16575de7b858256b6ddfa4b5
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/159250
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
LibjpegScanlineDecoder previously used a const_cast in
GetWritableSrcData() to mutate the input span in place when repairing
missing trailers or corrupted scanner headers.

Avoid mutating the caller's source span by implementing copy-on-write
in GetWritableSrcData(). When repair is necessary, allocate and populate
an owned DataVector buffer member called `corrected_src_data_`.

-- Remove redundant DCHECK() give checked span usage.

Fixed: 567106301
Change-Id: Icdefd8592b0600333a0b16ef9ecba3329310c365
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/159210
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Introduce fxcrt::ToDataVector(range) in core/fxcrt/data_vector.h
to construct a DataVector<T> from a range or span in C++20 without
verbose iterator-pair construction until C++23 std::from_range is
available.

-- Remove redundant CHECK() give checked span usage.

Change-Id: I2f16abbec60495e441fee13dbea64958613d43dd
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/159230
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
This CL adds the FPDF_StructElement_GetRawType() API alongside the
backend API CPDFStructElement::GetRawType() to access the raw,
unprocessed value of the /S entry. This allows embedders to be able to
access original values if needed without editing the behaviour of
existing, stable APIs that embedders may already use.

Also update the CPDFStructElement class constructor to use this new API.

Bug: 42270951
Change-Id: I55cdbe91a4c74fca7db16fc6adad7cd0dab75d15
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/158130
Reviewed-by: Andy Phan <andyphan@chromium.org>
Commit-Queue: Andy Phan <andyphan@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Add helper for ordinary std::vector<> aligned with what was added
for PDFium's DataVector<>.

Change-Id: I8546a212953a82aae44af62b3d315a43e738485d
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/159330
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Convert a few instances missed in the prior CL.

Change-Id: I73cfc023750d539b1394b29dec7bcfaed9149208
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/159310
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Avoid mutating the input span in-place with const_cast in
RustJpegScanlineDecoder. Make a copy of the input source data into a
vector on demand when patching is required, matching the behavior
of LibjpegScanlineDecoder.

Change-Id: I0ead4a23f95ce24518ebec1da07e52e279bc9302
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/159270
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
@bobsingor
bobsingor merged commit 4366dcc into embedpdf/main Oct 13, 2026
14 of 15 checks passed
@bobsingor
bobsingor deleted the embedpdf/sync/3c9748bd6 branch October 13, 2026 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.