Skip to content

Sync S18: merge upstream PDFium up to 1f02bc7d90 (Nov 13 2026) - #122

Merged
bobsingor merged 48 commits into
embedpdf/mainfrom
embedpdf/sync/1f02bc7d90
Nov 15, 2026
Merged

bobsingor merged 48 commits into
embedpdf/mainfrom
embedpdf/sync/1f02bc7d90

Conversation

@bobsingor

Copy link
Copy Markdown
Contributor

Release-gate sync: 47 upstream commits, 6688c57 to 1f02bc7 (upstream's tip, more than a day old). Report: docs/embedpdf/syncs/2026-11-15-1f02bc7d90.md.

  • The object-tree traversal now builds a reference graph and finds cycles by DFS (a724e52c52, 583f8062d0), so a stream used in two places is no longer taken for unshared. Our page content generator relies on that check. Our resolve mode (layer-save) moves into upstream's graph builder.
  • Upstream fixed our FlatePredictorScanlineDecoder::Rewind() bug the same way; ours is dropped (bug-fix rule).
  • 192-bit AES keys are rejected. Our secure-random IVs stay, and nothing of ours offers 192-bit keys.
  • Annotations from FPDFPage_CreateAnnot() are now indirect objects (89660bafdb). The engine creates annotations with EPDFPage_CreateAnnot*, so nothing changes for it. Our direct-annotation flatten test now writes its annotation into /Annots itself.
  • Upstream's new tests record fork behaviour where it differs: the line, caret, widget and redact subtypes we create, and our right-to-left /ActualText extraction (3 of 6 lines right against upstream's 1; digits and punctuation still land on the wrong side, bug B5 in the RTL plan; upstream's TODOs kept on those lines).
  • Conflicts (8): the traversal, crypto handler, image, flate, unicode and build files; resolved by keeping both sides or upstream's identical fix.
  • Layer-mode writers: upstream's four new writing tests recorded; 144 informational count changes, mostly one more object per indirect annotation.
  • No API change.

Local checks (darwin-arm64): 1402 unit tests pass; embedder tests unchanged (the 12 known Mac golden failures); layer mode; tag, C API, globals and exports checks; every target's patches; wasm32 build.

If you run CI on this branch, let it finish before merging: merging deletes the branch, and build jobs that start afterwards fail at checkout. Merge with a merge commit, not squash.

pdfium-autoroll@skia-public.iam.gserviceaccount.com and others added 30 commits November 8, 2026 20:49
https://chromium.googlesource.com/chromium/src/tools/memory.git/+log/3d4610fc0dd4..db1b13009b4a

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/memory-tools-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: I43b3b127ecc497bbbfcd460bfe5c13d822aa5ecb
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/163710
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>
https://chromium.googlesource.com/chromium/tools/depot_tools.git/+log/a03dfbf7f2d1..96a7c1418eed

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/depot-tools-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: I02382693ee9274f74674882e6480dda619baf902
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/163690
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>
Introduce core/fxge/fx_libyuv_wrappers.h and fx_libyuv_wrappers.cpp to
wrap libyuv calls in namespace pdfium with functions that take
pdfium::span arguments. Provide both 2D plane functions and single-row
helpers. Centralize width, height, stride, and span size validation in
the wrappers so callers can pass spans directly instead of converting
spans to raw pointers.

Update all libyuv callers in CFX_DIBBase, CFX_DIBitmap,
CFX_ScanlineCompositor, CreateSkiaImageFrom24BppDib(), and ReverseRGB()
to use the new wrappers, and restrict third_party/libyuv includes to
fx_libyuv_wrappers.cpp in DEPS.

This CL is AI generated.

Bug: 579492484
Change-Id: I28c99c0429abea2a24415f3e96be88f67bb50430
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/163210
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
The u8<->u32 BitCast in the kernels fails to compile on HWY_SCALAR. So
add a scalar-loop fallback.

Bug: 581790991
Change-Id: I1649569bbc4b171543f4c78f91ad82c288627bab
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/163330
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Andy Phan <andyphan@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
It's not used. Disallow copy and assignment.

Change-Id: I9ef9b2f2bfcc3023b48265eec6c45e0162284835
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/163731
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Add comprehensive unit tests covering all methods in CPDF_IconFit:
GetScaleMethod, IsProportionalScale, GetFittingBounds,
GetIconBottomLeftPosition, GetScale, and  GetImageOffset.

Change-Id: Ic3543c3e9bfdf685ab10a3d11734c8d6089d251f
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/163590
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Mutating a page's content invalidates any active progressive rendering
context associated with that page. Call ClearRenderContext() in
FPDFPage_GenerateContent() so that an in-flight progressive render
terminates cleanly, causing subsequent calls to
FPDF_RenderPage_Continue() to return FPDF_RENDER_FAILED rather than
operating on stale page state.

Add an embedder test verifying that calling FPDFPage_GenerateContent()
causes subsequent FPDF_RenderPage_Continue() to fail cleanly.

First step towards fixing related bug.

Bug: 582607114
Change-Id: I1a1176b61c7f9a42e848804bc0050a0613a851ef
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/163750
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Hold candidate collections in
`CFXJSE_Engine::ResolveObjectsWithBindNode()` and
`CFXJSE_ResolveProcessor::DoPredicateFilter()` via
`cppgc::Persistent<GCedVector<CXFA_Object>>` instead of untraced
stack-local vectors of `cppgc::Member<>`.

This keeps candidate nodes alive across arbitrary script execution
during predicate evaluation and nested resolution loops in face of
synchronous garbage collection.

Bug: 575092240
Change-Id: I9d02e9d0c83fcdf5be611d616190065ad231590e
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/163490
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Add a copy of Chromium's base::Extend() as pdfium::Extend(), with a
template parameter to support DataVector. Then use it in
CPDF_CMapParser::HandleCodeSpaceRange() and SetupStrokePaint() to
simplify/improve the code.

This CL is AI generated.

Change-Id: I89bbb13460228a9061201fd71b0e9d29890c1818
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/163810
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Since std::array is hardened by default, use that and get rid of the
UNSAFE_BUFFERS() and CHECK_LT() usage.

This CL is AI generated.

Change-Id: I234059ed2c8c6ee1eeeb165529027c6c69042316
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/163830
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
- Add tests for FX_GetHourFromTime, FX_GetMinFromTime,
  FX_GetSecFromTime.

- Add tests for FX_IsValidMonth, FX_IsValidDay, FX_IsValid24Hour,
  FX_IsValidMinute, and FX_IsValidSecond.

- Add tests for FX_MakeDay, FX_MakeTime, FX_MakeDate, and
  FX_ParseStringInteger.

- Add tests for FX_ParseDateUsingFormat covering full month names
  (mmmm), abbreviated month names (mmm), numeric month fallbacks,
  2-digit year heuristics, multi-character literal handling,
  interchangeable separators, and error validation paths.

Change-Id: I855d7bd1825671474f4e623ac476d88a1bc607ae
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/163511
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Instead of having a separate counter, just keep track of whether `src`
has sufficient number of elements. To avoid repeated `n * 4`
calculations, save that value as `n4`.

Change-Id: I9362e607229be2e5bfe86aecffa36372f24a079a
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/163850
Reviewed-by: Andy Phan <andyphan@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Split the 24-bpp and 32-bpp cases into separate branches instead of
using raw pointer arithmetic in a single loop:

- For the 24-bpp case, use fxcodec::ReverseRGB() per row. (Which can use
  libyuv internally.)
- For the 32-bpp case, use libyuv::ARGBToRAW() when libyuv is available,
  or fall back to fxcrt::Zip() per row. Access to ARGBToRAW() goes
  through core/fxge/fx_libyuv_wrappers.h.

This CL is AI generated.

Change-Id: I6d42975104def182b07fe66535cea82d84c809e2
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/162750
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Instead of vector of persistent, use a single persistent into a wrapped
vector of members.

Change-Id: Ic44ae0cb1adbf81dc8c7cc2fe3b9f28b742d0ea1
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/163831
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Test FormCalc parser and AST code generation for while loops,
for-loops (upto with step, and downto), foreach-in loops, do-blocks,
and break/continue statements. Also add error parsing test cases
for malformed loop and block syntax.

Change-Id: I201fc3587b8f3e5d02120a1cfce512e2ebc54fca
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/163470
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Neccessary but vastly insufficient step for turning on heap per
document mode in PDFium. In doing so, pick up a few pointers
on the heap which could not hurt.

Earlier versions of cppgc suffered from bugs when tracing partially-
constructed objects during stack scans, leading to the selection of
`kNoConservativeStackScan`. Modern cppgc safely handles in-construction
objects without invoking `Trace()` on uninitialized members.

Change-Id: Ifb9259d36f892a5e185e74dd4969e8ea6fa7f0ef
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/163570
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Add test cases in cfx_xmlparser_unittest.cpp covering empty inputs,
invalid tag names (starting with digits), and processing instructions
containing question marks.

Change-Id: Ia9defd7d1bfba5063bd85fdcb1ed5ef692df2794
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/163611
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Change DispatchBgra2Bgra(), DispatchBgra2BgrxForceOpaque(),
RunBgra2Bgra(), and RunBgra2BgrxForceOpaque() to accept
FX_BGRA_STRUCT<uint8_t> spans instead of uint8_t spans. This avoids
calling fxcrt::reinterpret_span() in CompositeRowBgra2BgraSimd() and
CompositeRowBgra2BgrxForceOpaqueSimd(), and eliminates the `n4` byte
count variable in the SIMD loops. The spans now iterate 1 element at a
time, while still providing the same pointers to Highway.

Also update CompositePixelBgra2Bgra() to operate on
FX_BGRA_STRUCT<uint8_t> directly instead of packing and unpacking pixels
with FXARGB_GetDIB() and FXARGB_SetDIB(), and use fxcrt::Zip() for the
scalar tail loops in RunBgra2Bgra() and RunBgra2BgrxForceOpaque().

This CL is partly AI generated.

Change-Id: I9a658158650ed15a1411e5f264c8b8c3e06b3633
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/163870
Reviewed-by: Andy Phan <andyphan@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Test CPVT_FontMap methods: GetPDFFont and GetPDFFontAlias across valid,
boundary, and invalid font indices (default font index 0, out-of-range
indices -1 and 2). Also test system font resolution via GetPDFFont(1)
and GetPDFFontAlias(1) with null document, null resource dictionary,
and valid resource dictionary with font cache.

Change-Id: Iffecd4db100624af56c4fc88157034aabecf8201
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/163610
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
- cfx_cssdeclaration: Add tests for named color parsing (red, green,
  blue), string unquoting, standard property additions (color, font,
  text alignment, borders), and !important flag handling.

- cfx_cssstyleselector: Add cfx_cssstyleselector_unittest.cpp testing
  default font size scaling, inline style computation, align strings,
  inherited property propagation, and user-agent stylesheet matching.

Change-Id: Ib497f219a28eed7b1fa9ff7ca18e754895098ed3
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/163591
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Exercise FPDFPage_SetBleedBox, FPDFPage_SetTrimBox, and
FPDFPage_SetArtBox in FPDFTransformEmbedderTest, verifying that the
bounding box values update on the live page and persist across saving
and reloading.

Also exercise FPDFPageObj_TransformClipPath in FPDFEditEmbedderTest,
verifying that matrix scaling and translation correctly transform the
path segments of a page object's clip path.

Bug: 42270238
Change-Id: I01c25cdb08fd8f2f04d594d09cac9f5a827c9ad3
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/163650
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Demonstrate FlatePredictorScanlineDecoder::GetScanline() produces
different results after an implicit Rewind().

This CL is AI generated.

Bug: 584197771
Change-Id: Ida0283f57273f8719272e7a3cf920c978d558601
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/163931
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
As suggested in the bug report, clear `last_line_` in
FlatePredictorScanlineDecoder::Rewind(). Then update unit test
expectations now that the bug has been fixed.

Bug: 584197771
Change-Id: I7a597f3b341949d532b67f22728b32f95f1e6b7b
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/163932
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Directly test FPDFAnnot_IsSupportedSubtype and
FPDFAnnot_IsObjectSupportedSubtype against supported subtypes,
unsupported subtypes, and boundary/invalid values.

Change-Id: Ib586952907300e07dfd4b478cb8dcdbfd685b3d2
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/163612
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Add test cases in app_methods.in covering app.clearInterval,
app.clearTimeOut, app.setInterval, and app.setTimeOut, verifying
both valid calls and error handling for invalid argument counts and
types.

Add tests in field_properties.in for commitOnSelChange,
currentValueIndices, editable, multipleSelection, numItems, required,
and textFont across text fields, radio buttons, checkboxes,
multi-select listboxes, and single-select listboxes.

Change-Id: Ib96a36c99ebb9aaf9af7ac10453260ded1560e22
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/163593
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Add unit tests in cfx_barcode_unittest.cpp covering CFX_Barcode::GetType
across all barcode formats, start and end delimiter character mutators,
1D versus 2D property configuration, error correction levels, module
dimensions, text locations, EAN truncation on oversized contents,
Code128C odd-length padding, and validation failure cases.

Change-Id: I429d5e3faf18fa65f402e8f9c47b826ae8e03bff
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/163613
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Remove SetFontStyle and the backing font_style_ member variable from
CBC_OneCode and CBC_OneDimWriter. font_style_ was initialized to 0 and
never read in any rendering or calculation, and SetFontStyle was never
exposed on CFX_Barcode or called anywhere in PDFium.

Change-Id: Ic5c35ba59cd346a9ffa4c84cf51922027eabbafc
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/163670
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
This reverts commit d340036.

Reason for revert: Use after poison

Failure Link: crbug.com/584686932

Original change's description:
> Support conservative stack scanning in standalone cppgc heap
>
> Neccessary but vastly insufficient step for turning on heap per
> document mode in PDFium. In doing so, pick up a few pointers
> on the heap which could not hurt.
>
> Earlier versions of cppgc suffered from bugs when tracing partially-
> constructed objects during stack scans, leading to the selection of
> `kNoConservativeStackScan`. Modern cppgc safely handles in-construction
> objects without invoking `Trace()` on uninitialized members.
>
> Change-Id: Ifb9259d36f892a5e185e74dd4969e8ea6fa7f0ef
> Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/163570
> Commit-Queue: Tom Sepez <tsepez@chromium.org>
> Reviewed-by: Lei Zhang <thestig@chromium.org>

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

No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Change-Id: I8e33170dc085b99c959599f657fef809f5f036e5
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/164070
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Auto-Submit: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Call `dest.first(src.size())` at the beginning of RunBgra2Bgra() and
RunBgra2BgrxForceOpaque(). Although CompositeRowBgra2BgraSimd() and
CompositeRowBgra2BgrxForceOpaqueSimd() already checked `dest` has a
valid size compared to `src`, that relationship is lost across the
Highway dispatch. Once the compiler can see the equal span sizes inside
the kernels, the compiler can then eliminate the per-iteration
`dest.subspan()` bounds check and extra size tracking in the SIMD and
scalar tail loops.

Change-Id: I9bae29e000b67d1c570e8ef727ce28a8206469a3
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/164050
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
FPDFPage_CreateAnnot appended the annotation dictionary directly into
the page /Annots array. ISO 32000-1:2008 Table 30 requires each entry
to be an indirect reference, so a direct dictionary has no object
number and readers that only follow references never see it.

Convert the new entry to an indirect object after it is appended, and
add an embedder test that a saved highlight is stored only as a
reference.

Bug: 584383499
Change-Id: I13b5b2314b337d7cdc2d18d862d9e087751db267
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/163990
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
leizleiz and others added 18 commits November 11, 2026 10:58
Avoid using -1 as a sentinel value for "unknown line count". This avoids
the need to use checked_cast().

Change-Id: I4a624a6f32c1df7d306c8168f3fb9d480b232e4a
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/164010
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Andy Phan <andyphan@chromium.org>
No functional change, but makes updating algorithms in follow-on
CLs easier to review. Collapsing a set of nested dictionaries or
arrays into a single node for tracing is complex and should be
separated from the tracing itself.

- Introduce tree_traversal_util.h/.cpp with AdjacencyMap to
  perform pure graph analysis on node IDs independently of CPDF_Object
  structures.

- PdfReferenceGraphBuilder in object_tree_traversal_util.cpp walks
  the PDF document to extract the reference graph and passes it to
  CalculateReferenceCounts().

- Retain the existing reference-counting algorithm using a BFS queue
  and seen_ref_objects.

- Add unit tests in tree_traversal_util_unittest.cpp covering basic
  DAG traversal, forward edges, self-loops, and disconnected components.

Change-Id: Ia4ee18e29310cfc88b4a843856c2366cad2fcce6
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/163790
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Effectively apply the following Chromium CLs:
- crrev.com/1501220 - Use current_cpu instead of target_cpu
- crrev.com/1632679 - GN format

Also remove an obsolete ppc64/s390x workaround, since the upstream
Highway bug has been fixed.

Change-Id: I5ae3be5a9afe393d77817ce461879fde407ec156
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/164030
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Andy Phan <andyphan@chromium.org>
Remove stray header, fix typo, and make .cpp/.h file argument names
agree with each other.

Change-Id: I7f9a878876cdd94b094fb347bd95d626d6aafb27
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/164130
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Add actual_text_rtl_glyphs.in and
FPDFTextEmbedderTest.ActualTextOnRtlGlyphsWithNumbersAndPunctuation.
Unlike ActualTextRtl, its /ActualText spans mark RTL glyphs instead of
Latin ones, which takes different code paths in CPDF_TextPage, and the
/ActualText contains numbers and punctuation. The test documents how
CPDF_TextPage extracts these lines today. Only the line without
/ActualText comes out right, so mark the others with TODOs.

Also add a TODO to ActualTextRtl, as /ActualText should not be mirrored.

Bug: 525087036
Change-Id: I92dab436143b0d97c435c85d66afabe976239b89
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/162250
Commit-Queue: Andy Phan <andyphan@chromium.org>
Reviewed-by: Andy Phan <andyphan@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Update CFWL_ComboBox::SetCurSel(), SetEditText(), and Layout() to call
edit_->SetTextSkipNotify() rather than edit_->SetText().

Programmatic model-to-widget synchronization (via LoadWidget() and
UpdateFWLData()) must not notify and dispatch TextWillChange/EditChanged
events, which synchronously execute attacker-authored Change scripts
during initial page layout or data binding updates.

As with the hardening in CXFA_FFTextEdit::UpdateFWLData(), using the
silent path prevents unintended script re-entrancy while preserving
notifying behavior for user interactions.

Update test replacing change event with an enter event since layout no
longer dispatches change events. Remove unused preceding field to allow
the initial tab keypress to focus the choiceList directly.

Fixed: 575157680
Change-Id: I16f44ad616be3ce6c34058dfc546fddeaf9daf80
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/163952
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Demonstrate FaxDecoder::GetScanline() produces different results after
an implicit Rewind().

This CL is AI generated.

Bug: 584665233
Change-Id: I370d44e501dc735b3785e21333bff2814ab2d616
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/164172
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
As suggested in the bug report, reset `byte_align_` in
FaxDecoder::Rewind(). To make this work, store the original
`byte_align_` value as a new const FaxDecoder member variable. Then
update unit test expectations now that the bug has been fixed.

Bug: 584665233
Change-Id: I1791f2ff28d263d67ec9967fbba6a363657857c1
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/164173
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Path coordinates with extreme values can exceed the representable
range of 32-bit signed integers when transformed and adjusted to
pixel centers. Use pdfium::saturated_cast<int> instead of
static_cast<int> when adjusting simple line paths in
CheckSimpleLinePath to avoid float-cast-overflow.

Fixed: 582306045
GWSQ_IGNORES: no-reply@google.com
PiperOrigin-RevId: 1014761920
Change-Id: I730f1d623d1fb312739446ae4aa3149da4badd44
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/164270
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
The previous cycle-detection heuristic tracked all objects that had
previously acted as the source of any reference edge in a set
`seen_ref_objects`.

This heuristic was fundamentally flawed:
1. Being in `seen_ref_objects` merely means that an object has outgoing
   edges that were processed earlier in the BFS traversal. It does not
   mean V is an ancestor of U.
2. In any directed acyclic graph (DAG) where V is explored before U
   (such as at a shallower depth or earlier sibling) and both nodes have
   outgoing edges, a valid cross-edge U -> V was incorrectly discarded
   as circular.
3. This led to false negatives in GetObjectsWithMultipleReferences().
   Shared objects were classified as unshared. When an object (such as
   a page content stream also referenced as an image) was subsequently
   edited, CPDF_PageContentManager::UpdateStream() modified the stream
   in place rather than cloning it.

Using DFS fixes the specific issue in the reported DAG/PoC but still
isn't completely fixed until the next CL.

Bug: 582607114, 578689228
Change-Id: I66c38d3aa6f5741b7bd4d3d6f76ccea5e4b78bcd
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/163791
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Add rtl_multi_char_glyph.in, which draws the text from the bug report,
سلام کلاس لاله, with the lam-alef ligature as one glyph that maps to two
characters. Then add a test that documents how CPDF_TextPage extracts it
today. Without a mirrored matrix, lam and alef come out swapped, so mark
that with a TODO. With a mirrored matrix, the text comes out right.

Bug: 575985355
Change-Id: If00389aeae833fbce67f8510ec4a41aee969ec63
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/162270
Commit-Queue: Andy Phan <andyphan@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Andy Phan <andyphan@chromium.org>
Add a Highway implementation for BGRA to 8bpp mask compositing. Rows
with at least 128 pixels use the SIMD path, while shorter rows retain
the scalar path.

Initial microbenchmarks on an AMD Ryzen 7 9800X3D show 1.15x-6.73x
speedup for SIMD-eligible rows. For 128-pixel rows, the speedup is 3.57x
without clipping and 1.97x with clipping. For 2048-pixel rows, it is
6.61x and 2.77x respectively.

Additional runs on the same CPU, with each SIMD target forced
individually, show the following speedups relative to scalar compositing
for 128-pixel mixed-alpha rows:

  Target    Without clipping    With clipping
  SSE2                 1.25x            0.72x
  SSSE3                1.41x            0.76x
  SSE4                 1.94x            1.32x
  AVX2                 2.41x            1.84x

Ratios below 1 indicate a slowdown. The clipped SSE2/SSSE3 paths also
regress for longer rows, so the 128-pixel threshold alone does not
address these regressions. Retain the threshold in this CL and defer
target-specific tuning to a follow-up.

Add tests for clip and alpha combinations, vector tails, unaligned
buffers, and the public compositor entry point.

Change-Id: Idbbd1de654d52204b36b95c61aa7a2ce1d30127b
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/163370
Reviewed-by: Andy Phan <andyphan@chromium.org>
Commit-Queue: Andy Phan <andyphan@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Using raw_ptr<T> with GCed T is already prohibited by the clang plugin.
In PDFium, the UnownedPtr<T> alias made the plugin miss the raw_ptr.
A coming plugin update will change that, and the plugin will alert on
UnownedPtr<T> with GCed T.

Replace UnownedPtr<T> fields pointing to GCed XFA/FWL objects in
stack-allocated classes with raw pointers, and mark CFWL_ThemePart,
CFWL_ThemeBackground, and CFWL_ThemeText as CPPGC_STACK_ALLOCATED().

Change-Id: I316dadacf350f77d249b2590e59db7d25ffcf20d
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/164350
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Auto-Submit: Omer Katz <omerkatz@google.com>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
The PDF standard (ISO 32000-1 / ISO 32000-2) does not define AES-192.
Crypt filters for AES are strictly 128-bit (AESV2) or 256-bit (AESV3).
Allowing 24-byte keys in IsValidKeyLengthForCipher() permitted crafted
PDFs specifying /Length 192 to reach the per-object derivation block in
EncryptContent(), triggering a CHECK failure due to buffer undersizing.

Remove keylen == 24 from IsValidKeyLengthForCipher() to reject documents
requesting 192-bit AES at load time. Update the matching DCHECK in
CPDF_CryptoHandler.

Introduce RequiresPerObjectKeyDerivation() to clarify whether a cipher
and key length combination calculates an object key, replacing negative
checks against key_len_ == 32.

Fixed: 585348292
Change-Id: I4046710e343e9142e82ae336659a055c6837e1c8
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/164450
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Consistently treat invalid alignment values as left-aligned in the 2
InitBreak() methods. Also rename `iAlign` to follow the style guide.

Bug: 582906999
Change-Id: I38f922dcb5ecc883d8b789bb4545bc3155f26ab5
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/164310
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Track V8 wrappers created by CJX_Tree::nodes() and
CJX_Tree::ResolveNodeList() in map_object_to_object_ via
GetOrCreateJSBindingFromMap(). This guarantees that ~CFXJSE_Engine()
clears their bindings on teardown so that surviving wrappers do not
retain dangling pointers to swept cppgc objects.

Additionally, return the existing wrapper from
CFXJSE_Engine::NewNormalXFAObject() if an object is already present
in map_object_to_object_ instead of overwriting the entry and orphaning
earlier wrappers.

Fixed: 581308574
Change-Id: I46d421be057c5a3454b0d819d5ef11726ac090b2
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/163630
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
CFXJSE_HostObject is an embedder payload stored in the internal fields
of a V8 object. Exposing NewBoundV8Object() as a member function on
CFXJSE_HostObject inverted layering by allowing passive host objects to
create V8 instances and bind themselves behind the back of the engine.
This led to callers instantiating wrappers that bypassed the engine's
binding map.

Move object creation and binding to FXJSE_CreateBoundObject() in
cfxjse_context.h, accessible only to engine-level callers. This should
prevent future mistakes.

Change-Id: I08bf507f1843f5481f90c8f9a37cd998166aa057
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/163592
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Release-gate sync: 47 upstream commits, 6688c57 to 1f02bc7
(upstream's tip, more than a day old).
Report: docs/embedpdf/syncs/2026-11-15-1f02bc7d90.md.

- The object-tree traversal builds a reference graph and finds cycles
  by DFS, so shared objects are no longer missed; our resolve mode moves
  into upstream's graph builder.
- Upstream fixed our FlatePredictorScanlineDecoder::Rewind() bug the
  same way; ours is dropped.
- 192-bit AES keys are rejected; our secure IVs stay.
- New annotations from FPDFPage_CreateAnnot() are indirect: our flatten
  test writes its direct annotation into /Annots itself.
- Upstream's new tests record fork behaviour where it differs: the
  annotation subtypes we create, and our RTL /ActualText extraction
  (better than upstream's, still wrong on digits and punctuation).
- Record upstream's four new layer-mode writers and the counts that
  rise with indirect annotations.
@bobsingor
bobsingor merged commit f2ea759 into embedpdf/main Nov 15, 2026
1 check passed
@bobsingor
bobsingor deleted the embedpdf/sync/1f02bc7d90 branch November 15, 2026 19:35
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.

7 participants