Skip to content

Reject malformed timezone data and unsafe zone names - #36

Merged
alexey-milovidov merged 2 commits into
mainfrom
codex/orc-timezone-validation-main
Oct 24, 2026
Merged

alexey-milovidov merged 2 commits into
mainfrom
codex/orc-timezone-validation-main

Conversation

@skuznetsov-clickhouse

@skuznetsov-clickhouse skuznetsov-clickhouse commented Oct 13, 2026 •

Copy link
Copy Markdown

What changes were proposed in this pull request?

Reject empty TZif input, zero-byte timezone files, TZif headers with no local-time types, unterminated timezone designations, and truncated TZif v2 future strings with TimezoneError. Validate serialized timezone names before joining them to TZDIR, including lexical traversal, absolute and drive-like paths, empty components, trailing dots or spaces, and Windows device names. Preserve lazy lookup and valid IANA paths.

This applies the parser and path guards from the now-merged ClickHouse/2.3.1 PR to ORC main.

Why are the changes needed?

Controlled inputs on the unpatched ClickHouse ORC branch reproduced aborts for empty or zero-type timezone data, an ASan overflow for an unterminated designation, and a relative path that loaded a controlled TZif outside TZDIR. A valid two-section TZif v2 with a 0- or 1-byte footer threw std::length_error on this branch before the guard. The tests target these input boundaries. They do not establish the exact cause in Anthropic's private binary.

How was this patch tested?

The isolated Ubuntu build passed TestTimezone.* 18/18, including invalid and valid boundary inputs. With a scratch tzdata overlay containing the missing US/Pacific alias, the C++ test binary passed 747/747 after excluding TestTimezone.testTzdbFromCondaEnv. A full 748-test run with TZDIR set failed in that existing test because it changes CONDA_PREFIX to Windows backslash syntax on Linux and exits before restoring it; subsequent timestamp tests then inherited the broken variable. The excluded test also passed in the focused suite with TZDIR unset, where its conditional body does not run. git diff --check passed. A formatting-only follow-up at 9f008cf1 rebuilt orc-test and passed TestTimezone.* 18/18. The C++ formatter and Ubuntu CI jobs passed on this head.

ASan/UBSan on this main build, Windows CI, downstream ClickHouse integration, and the customer package remain unverified. ClickHouse integration is in ClickHouse#125651, with CI pending. The Javadoc and macOS jobs fail on unmodified main at external setup/download steps; the Windows jobs were cancelled. A separate sanitizer configure stalled at the project's Maven download. The name check is lexical: a pre-existing symlink in an untrusted TZDIR can 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).

Empty TZif data and zero variants can abort the parser; unterminated designations can read past the buffer. Reject those inputs, truncated TZif v2 future strings, and unsafe timezone path syntax before opening a file. Keep valid IANA paths and lazy lookup behavior.

Verified: focused red-before probes for empty/zero-variant/unterminated and v2 footer inputs; TestTimezone.* 18/18; C++ test binary 747/747 with the pre-existing Linux CONDA_PREFIX backslash test excluded. Windows and customer-package validation remain open.
@github-actions github-actions Bot added the CPP label Oct 13, 2026
The ORC main CI format check rejected line wrapping in the timezone guard and tests. Apply the reported clang-format-13 changes without altering non-whitespace content.

Verified: git diff --check; Debug ORC main rebuild and TestTimezone.* 18/18 on Chaos Lab. Remaining: CI format rerun and Windows coverage.
@skuznetsov-clickhouse

skuznetsov-clickhouse commented Oct 19, 2026 •

Copy link
Copy Markdown
Author

I compared the failed logs with the unmodified main run (https://github.com/ClickHouse/orc/actions/runs/37810662586). Both runs fail Javadoc while fetching the same missing package-list URLs. The macOS jobs stop at the same snappy_ep configure step, before ORC tests; the underlying Snappy configure error is not in the job log. Linux build/test and formatting pass here. Could you review this main counterpart to #35?

@alexey-milovidov alexey-milovidov self-assigned this Oct 24, 2026
@alexey-milovidov
alexey-milovidov merged commit 8b9a55f into main Oct 24, 2026
14 of 25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants