Skip to content

Backport #121693 to 26.8: Guard the JSON AST deserialization recursions with checkStackSize - #121853

Merged
clickhouse-gh[bot] merged 2 commits into
26.8from
backport/26.8/121693
Sep 24, 2026
Merged

clickhouse-gh[bot] merged 2 commits into
26.8from
backport/26.8/121693

Conversation

@robot-ch-test-poll

@robot-ch-test-poll robot-ch-test-poll commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Original pull-request #121693

This pull-request is a last step of an automated backporting.
Treat it as a standard pull-request: look at the checks and resolve conflicts.
Merge it only if you intend to backport changes to the target branch, otherwise just close it.

The PR source

The PR is created in the CI job

Version info

  • Merged into: 26.8.11.35

@robot-ch-test-poll robot-ch-test-poll added pr-backport Changes, backported to release branch. Do not use manually - automated use only! pr-bugfix Pull request with bugfix, not backported by default labels Sep 23, 2026
@clickhouse-gh

clickhouse-gh Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [BackportPR], commit [a7aa824]

Summary: ✅

@groeneai

groeneai commented Sep 23, 2026 •

Copy link
Copy Markdown
Collaborator

The build failure is a missing include on this branch, not a bad cherry-pick

Build ClickHouse failed on all 7 configurations at 443fd99, and each of the 7 job logs contains exactly one compile error and one failed target:

src/Parsers/ASTJSONReadHelpers.cpp:132:5: error: use of undeclared identifier 'checkStackSize'

#121693 adds a checkStackSize() call to JSONObjectReader::readFieldFromObjectImpl. On master that file also includes Common/checkStackSize.h, but the include is not part of #121693: it arrived with 89b1efa95a9d (#120507, merged 2026-09-19), which has no pr-must-backport label and so was never cherry-picked to any release branch. The hunk therefore lands in a file where the symbol is undeclared.

One line fixes it, and nothing else from #120507 is needed:

--- a/src/Parsers/ASTJSONReadHelpers.cpp
+++ b/src/Parsers/ASTJSONReadHelpers.cpp
@@ -4,6 +4,7 @@
 #include <Parsers/ASTFunction.h>
 #include <Parsers/ASTIdentifier.h>
 #include <Parsers/ASTLiteral.h>
+#include <Common/checkStackSize.h>
 #include <IO/ReadHelpers.h>

That is where master keeps it, after the Parsers/ block and before IO/ReadHelpers.h. With it applied, git diff master:src/Parsers/ASTJSONReadHelpers.cpp <fixed>:src/Parsers/ASTJSONReadHelpers.cpp is 84 deletions and 0 insertions, so the file becomes a strict textual subset of the version that compiles on master.

I cannot push here, so the commit is on my fork, as a fast-forward of this branch:

git fetch https://github.com/groeneai/ClickHouse fix-26.8-backport-121693-missing-include
git push origin FETCH_HEAD:backport/26.8/121693

212aafca03537de88770c20d43f90b8375ebe002, tree 8066161807bf4404fb7814d08c76ab8d1a315762: its parent is 443fd99 (git merge-base --is-ancestor 443fd997 212aafca returns 0) and git diff --name-only 443fd997 212aafca is exactly src/Parsers/ASTJSONReadHelpers.cpp.

I did not build this branch locally, since its submodule pins differ from master's, so the verification is static: the subset property above, plus ASTFromJSON.cpp compiling green in this very build while including that same header ([7173/17057] ... ASTFromJSON.cpp.o in the amd_debug log, and no log contains a second FAILED: line). The tests the cherry-pick carries have not run yet because the build never reached them; their blobs are identical to master's apart from this branch keeping its own pre-existing # Tags: no-old-analyzer line, and none of them touch the part of #120507 that is left behind.

#121854 (26.9) fails identically, with the same one-line resolution on fix-26.9-backport-121693-missing-include. #121851 (26.3) and #121852 (26.7) are a different case: the deserializer they patch does not exist on those branches, so I have suggested closing both.

…kport

26.8 lacked the earlier fix that added this include (and its own
checkStackSize() call) to ASTJSONReadHelpers.cpp, so the cherry-picked
checkStackSize() call in readFieldFromObjectImpl failed to compile.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@clickhouse-gh
clickhouse-gh Bot merged commit 75cc8d0 into 26.8 Sep 24, 2026
40 of 41 checks passed
@clickhouse-gh
clickhouse-gh Bot deleted the backport/26.8/121693 branch September 24, 2026 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-backport Changes, backported to release branch. Do not use manually - automated use only! pr-bugfix Pull request with bugfix, not backported by default

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants