Skip to content

Cherry pick #130311 to 26.3: Bump vendored expat from 2.9.0 to 2.10.0 - #130434

Merged
robot-ch-test-poll merged 4 commits into
backport/26.3/130311from
cherrypick/26.3/130311
Nov 11, 2026
Merged

robot-ch-test-poll merged 4 commits into
backport/26.3/130311from
cherrypick/26.3/130311

Conversation

@robot-clickhouse-ci-1

Copy link
Copy Markdown
Contributor

Original pull-request #130311

Do not merge this PR manually

This pull-request is a first step of an automated backporting.
It contains changes similar to calling git cherry-pick locally.
If you intend to continue backporting the changes, then resolve all conflicts if any.
Otherwise, if you do not want to backport them, then just close this pull-request.

The check results does not matter at this step - you can safely ignore them.

Before you resolve anything

Conflicts are often caused by a prerequisite change that has not been backported yet, rather than by a real divergence. The bot re-tries this cherry-pick against the release branch on every run, so if that is the case here it will merge itself as soon as the prerequisite lands, and you will see a comment saying so. Manual resolution is only needed while the conflict persists.

Troubleshooting

If the conflicts were resolved in a wrong way

If this cherry-pick PR is completely screwed by a wrong conflicts resolution, and you want to recreate it:

  • delete the pr-cherrypick label from the PR
  • delete this branch from the repository

You also need to check the Original pull-request for pr-backports-created label, and delete if it's presented there

The PR source

The PR is created in the CI job

actueleai and others added 3 commits November 9, 2026 11:53
`expat` is not a submodule: Poco vendors it, so the sources are re-vendored by
hand. This brings `base/poco/XML` from upstream `R_2_9_0` (commit a76b1174c1ea)
to `R_2_10_0` (commit a70841d9ffa6).

Security fixes that apply to code compiled here:

  - CVE-2026-113351 - denial of service via `XML_ParserReset` (`xmlparse.cpp`)
  - CVE-2026-115506 - billion laughs attacks are now detected quicker and for
    more of their variations: `accountingCurrentAmplificationTolerated` takes
    the not-yet-charged indirect bytes, and entity expanded sizes are resolved
    by an explicit-stack analysis in `resolveEntityClosureExpandedSize`
  - CVE-2026-117610 - segfault on initial non-final empty subparser parse calls
  - CVE-2026-118370 - signed integer overflow of `attIndex` and `nPrefixes` in
    `storeAtts`

CVE-2026-124317 is not mentioned in the upstream `Changes` for 2.10.0 (it is
not listed among the releases up to `R_2_10_0`) and is not fixed here.

Other upstream changes that matter for the compiled code: `XML_Parse` handles
`XML_CONTEXT_BYTES == 0` correctly, `m_parsingStatus.finalBuffer` is
initialized in `parserInit`, `isCalledFromInsideHandler` is checked first in
`XML_Parse`, a missing character-handler reset check and a missing
`m_startDoctypeDeclHandler` NULL check are added, `ENTITY.textLen` and
`ENTITY.processed` become `size_t`, and integer truncation in
`XmlGetAttributes`/`getAtts` is fixed. `parserInit` gained an `isReset`
parameter so that `XML_ParserReset` no longer clobbers the amplification
properties, and the allocator tracks `bytesAllocatedWhenLastReset` so one
document cannot skew the memory accounting of the next.

Local modifications re-applied on top of upstream 2.10.0:

  - the `EXPAT_POCO` blocks that replace expat entropy gathering with
    `Poco::RandomStream` (including reading into `unsigned long` for macOS)
    and the `XML_ResetHandlerCallDepth` helper
  - the `Poco/XML/expat.h` and `Poco/XML/expat_external.h` include paths
  - explicit casts on `malloc`/`realloc` results and on `void *data`, needed
    because `xmlparse.cpp` is compiled as C++
  - `extern "C"` guards in `internal.h`, `xmltok.h`, `xmlrole.h` and `xcs.h`,
    which upstream removed when it stopped mixing C and C++ translation units;
    here `xmlparse.cpp` is C++ while `xmltok.c`, `xmlrole.c` and `xmlxcs.c`
    are C
  - the removal of the `EXPAT_*_DEBUG` tracing (`getDebugLevel`,
    `unsignedCharToPrintable`, the accounting/entity/allocation report
    helpers, and the `debugLevel` and `peakBytesAllocated` fields), which
    upstream restructured in this release; the report call sites added by
    2.10.0 in `resolveEntityClosureExpandedSize` are dropped as well

Files: `entities.h` is a new upstream header included by `xmlparse.cpp` (with
the `Poco/XML/expat_external.h` include path applied). `xcs.h` gains the new
`xcsnstr` declaration; `xmlxcs.c` (upstream `xcs.c`) gains its definition.

`-Wno-declaration-after-statement` is added to the `_poco_xml_expat` target:
the new `xcsnstr` in `xmlxcs.c` declares a variable after a statement, which
`-Weverything` rejects even under `-std=gnu11`.

Co-Authored-By: Claude Code <[email protected]>
The style check's whitespace_check rejects ",  "; the other vendored expat
headers already carry the collapsed form.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Bump vendored `expat` from 2.9.0 to 2.10.0
@robot-clickhouse-ci-1 robot-clickhouse-ci-1 added pr-cherrypick Cherry-pick of merge-commit before backporting. Do not use manually - automated use only! do not test disable testing on pull request pr-critical-bugfix labels Nov 10, 2026
Resolve conflicts in `xmlparse.cpp`: release branch 26.3 still contains the
debug-output code removed on master by #126748, so take upstream expat
2.9.0 -> 2.10.0 changes on top of the branch file instead of the master file.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@robot-ch-test-poll
robot-ch-test-poll merged commit 1cbc60d into backport/26.3/130311 Nov 11, 2026
2 checks passed
@robot-ch-test-poll
robot-ch-test-poll deleted the cherrypick/26.3/130311 branch November 11, 2026 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do not test disable testing on pull request pr-cherrypick Cherry-pick of merge-commit before backporting. Do not use manually - automated use only! pr-critical-bugfix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants