Repository navigation
Reject malformed ORC timezone data and unsafe metadata paths - #35
Merged
skuznetsov-clickhouse merged 5 commits intoOct 19, 2026
Merged
Conversation
Empty timezone buffers and files, zero-type TZif headers, and unterminated designations could reach unchecked accesses. Unsafe serialized timezone names could escape the configured TZDIR. Validate counted input and lexical path syntax before access while keeping lazy resolution for integer-only readers. Add focused regressions and enable PR tests for the ClickHouse ORC vendor branch. Verification: isolated Linux Debug orc-test CTest 1/1 and explicitly instrumented strict ASan/UBSan TestTimezone 16/16 on these exact source blobs; git diff --check passed. GitHub CI, Windows, ClickHouse integration, and downstream packages remain unverified.
Windows reserves CONIN$ and CONOUT$ in addition to CON, PRN, AUX, NUL and COM/LPT names. Reject these spellings before opening timezone files, and cover case, extension and nested components in the Windows-only test. Verification: exact-file Linux Debug orc-test CTest 1/1 and strict ASan/UBSan TestTimezone suite 16/16 passed on isolated Chaos Lab. Windows CI remains pending.
The cpp-linter job rejected layout in the timezone guard and regression test. Reflow only those expressions to the repository format; parser behavior is unchanged. clang-format 21 dry-run on the reported ranges and git diff --check pass. CI clang-format 16 and platform tests remain pending.
A zero- or one-byte v2 footer underflows the string length and surfaces std::length_error instead of a timezone parse error. Reject it before constructing the string, while accepting the valid two-newline empty footer. Verified: isolated Debug CTest 1/1 and explicit ASan/UBSan TestTimezone.* 17/17 on Ubuntu GCC 15.2. Windows CI and customer package remain unverified.
This was referenced Oct 13, 2026
thevar1able
reviewed
Oct 14, 2026
thevar1able
reviewed
Oct 14, 2026
The build workflow tested pull requests to ClickHouse/2.3.1 but omitted that branch from its push filter, so a merged timezone fix would not receive post-merge CI. Add the branch to push.branches. Verified the staged diff is a single workflow line and passes git diff --check. The post-merge run remains to be observed.
skuznetsov-clickhouse
merged commit Oct 19, 2026
f3e6779
into
ClickHouse/2.3.1
31 of 32 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
Validate timezone data before indexing an empty byte vector, reading a zero-byte TZDB file, using a TZif header with no local-time types, scanning past the counted designation bytes, or constructing a string from a truncated TZif v2 footer. Invalid inputs raise
TimezoneError. Reject unsafe serialized timezone-name syntax before joining it toTZDIR, including traversal, absolute and drive-like names, empty components, trailing dots or spaces, and Windows device names. Keep lookup lazy for ORC reads that do not use timezone data. Enable the standard build/test workflow for PRs targetingClickHouse/2.3.1.Why are the changes needed?
On the unpatched vendor base, controlled test inputs reproduced separate SIGABRTs for an empty timezone buffer and a zero-byte TZDB file; a zero-type TZif also aborted, an unterminated designation caused an ASan overflow, and a relative name loaded a controlled TZif outside
TZDIR. A valid two-section TZif v2 with a 0- or 1-byte footer threwstd::length_errorinstead of a timezone parse error. The guards cover these parser invariants. These local reproducers do not establish the exact failure in Anthropic's private binary.How was this patch tested?
The crash reproducers ran only on an isolated Linux devserver and are not part of CI. Committed regression tests expect
TimezoneErrorfor invalid inputs and cover valid IANA names, aliases, the final-byte NUL boundary, the valid two-newline TZif v2 footer, lazy writer behavior, and Windows reserved-device spellings. On the final files, Debugorc-testpassed full CTest (1/1), and an explicitly instrumented ASan/UBSanTestTimezone.*run passed 17/17 enabled tests.git diff --checkpassed.Windows CI, downstream ClickHouse integration, and the customer package remain unverified. The existing sanitizer CMake options do not propagate instrumentation flags, so the local sanitizer build used explicit flags. The name check is lexical: a pre-existing symlink in an untrusted
TZDIRcan still resolve outside that directory.Was this patch authored or co-authored using generative AI tooling?
Generated-by: Codex (GPT-6 Luna Max and GPT-6, 2026-10-13).