Skip to content

Reject malformed ORC timezone data and unsafe timezone names (2.1.2) - #38

Merged
fm4v merged 1 commit into
ClickHouse/2.1.2from
fix-timezone-validation-2.1.2
Oct 29, 2026
Merged

fm4v merged 1 commit into
ClickHouse/2.1.2from
fix-timezone-validation-2.1.2

Conversation

@fm4v

@fm4v fm4v commented Oct 28, 2026

Copy link
Copy Markdown
Member

What changes were proposed in this pull request?

Port of #35 to ClickHouse/2.1.2, the ORC branch used by ClickHouse 25.12.

  • The TZif parser guards apply unchanged: an empty buffer or zero-byte TZDB file, a header with no local-time types, a designation that is not null-terminated within the counted bytes, and a truncated TZif v2 footer now raise TimezoneError.
  • The timezone-name check (hasSafeTimezoneNamePathSyntax, plus the empty TZDIR case) is adapted by hand to the 2.1.2 getTimezoneByName, which builds the path directly and has no TZ_ALIASES branch. An unsafe name returns the lazy invalid timezone, as in Reject malformed ORC timezone data and unsafe metadata paths #35.
  • The regression tests from Reject malformed ORC timezone data and unsafe metadata paths #35 are included, except the US/Pacific assertion: 2.1.2 has no alias map, so it would depend on the host tzdata shipping the backward links.
  • build_and_test.yml also runs for PRs targeting ClickHouse/2.1.2.

Why are the changes needed?

ClickHouse 25.12 passes output_format_orc_writer_time_zone_name and input_format_orc_reader_time_zone_name to ORC unvalidated, and the 2.1.2 TZif parser has the same unchecked accesses that #35 fixed on ClickHouse/2.3.1. Of the 8 Timezone.cc hunks in that PR, 7 apply here as they are.

Related: ClickHouse/ClickHouse#125651

How was this patch tested?

TestTimezone.cc and Timezone.cc were built locally against googletest 1.15.2. With the patch, 18 of 19 tests pass. The one failure, testTzdbFromCondaEnv, also fails on the unpatched branch in that environment. With the old Timezone.cc, the new tests fail starting at testEmptyTimezoneBuffer. The full ORC CI runs on this PR.

Was this patch authored or co-authored using generative AI tooling?

Generated-by: Claude Opus 5.5

Port of #35 to `ClickHouse/2.1.2`, used by ClickHouse 25.12. The TZif parser guards apply unchanged. The timezone-name check is adapted to the 2.1.2 `getTimezoneByName`, which has no `TZ_ALIASES` branch. The regression tests come along, except the `US/Pacific` assertion, which needs the alias map from 2.3. CI is enabled for PRs targeting `ClickHouse/2.1.2`.
@fm4v
fm4v merged commit 1baa621 into ClickHouse/2.1.2 Oct 29, 2026
12 of 28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant