Skip to content

Fix possible long type overflow in parseDateTime64BestEffort - #102890

Closed
Avogar wants to merge 5 commits into
masterfrom
fix-undefined-behaviour-in-best-time-parsing
Closed

Avogar wants to merge 5 commits into
masterfrom
fix-undefined-behaviour-in-best-time-parsing

Conversation

@Avogar

@Avogar Avogar commented Apr 16, 2026

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Fix possible long type overflow in parseDateTime64BestEffort.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

@clickhouse-gh

clickhouse-gh Bot commented Apr 16, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [5017c6a]

Summary: ❌

job_name test_name status info comment
Bugfix validation (functional tests) FAIL
04101_parseDateTime64BestEffort_double_dot_fractional FAIL cidb

AI Review

Summary

This PR hardens parseDateTime64BestEffort parsing for repeated fractional separators and adds focused stateless coverage for malformed fractional inputs. I did not find correctness, safety, performance, or compatibility issues in the current diff.

ClickHouse Rules
Item Status Notes
Deletion logging ➖
Serialization versioning ➖
Core-area scrutiny ✅
No test removal ✅
Experimental gate ➖
No magic constants ✅
Backward compatibility ✅
SettingsChangesHistory.cpp ➖
PR metadata quality ✅
Safe rollout ✅
Compilation time ✅
No large/binary files ✅
Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-bugfix Pull request with bugfix, not backported by default label Apr 16, 2026
Comment thread src/IO/parseDateTimeBestEffort.cpp Resolved
@nihalzp nihalzp self-assigned this Apr 16, 2026
Comment thread src/IO/parseDateTimeBestEffort.cpp Resolved
@alexey-milovidov

Copy link
Copy Markdown
Member

@groeneai, most of the failed tests here might be already fixed. Please update the branch.

@groeneai

Copy link
Copy Markdown
Collaborator

@alexey-milovidov this is @Avogar's PR (Avogar:fix-parsedatetime64-overflow on his fork) — I don't have push access to update the branch. cc @Avogar — could you rebase onto current master to pick up the fixed tests?

For context, I've been tracking this PR as it fixes the chronic function_prop_fuzzer UBSAN bug at parseDateTimeBestEffort.cpp:79-82 that's been hitting 30+ unrelated PRs over 14 days (cross-referenced on PR #101034 — your LGTM on 2026-04-26, also on PR #100186, PR #100736, and PR #100277 today). Once this lands, that whole class of failures clears across all affected PRs.

Also, @nihalzp has an open inline review suggestion on the error message wording ("Cannot read DateTime: duplicate fractional separator") — more specific than the current message. Worth applying as part of the rebase.

cc @Avogar @nihalzp

@alexey-milovidov

Copy link
Copy Markdown
Member

@groeneai, create a new branch with the same commits as this PR, and update it to master, then send a new PR, deprecating this PR.

@alexey-milovidov alexey-milovidov added the close in a month if not active This will be closed in case of no information label Apr 29, 2026
@groeneai

Copy link
Copy Markdown
Collaborator

@alexey-milovidov done — opened replacement PR #103717 per your directive.

Carries @Avogar's three commits unchanged (Author preserved on each, plus Co-authored-by trailers for visibility), rebased onto current master. Includes @nihalzp's wording suggestion (already applied here in commit 78798e6a), so no review-suggestion delta to apply. CI on the new branch should run cleanly without the stale infra failures from this PR.

Diff is byte-identical to #102890 HEAD — no code changes vs. what was already approved.

Closing this PR is up to you (I don't have permission to close someone else's PR). Pinging @Avogar @nihalzp on the new one.

@clickhouse-gh

clickhouse-gh Bot commented May 6, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 84.10% 84.10% +0.00%
Functions 91.10% 91.10% +0.00%
Branches 76.60% 76.60% +0.00%

Changed lines: 91.67% (11/12) | lost baseline coverage: 4 line(s) · Uncovered code

Full report · Diff report

@alexey-milovidov

Copy link
Copy Markdown
Member

Ok, this was already fixed in another PR.

pull Bot pushed a commit to TCeason/ClickHouse that referenced this pull request May 6, 2026
Adds expanded coverage (3 inputs * 3 OrNull/OrZero variants) for the
duplicate fractional-separator case in parseDateTime64BestEffort.

The underlying bug is already fixed on master by PR ClickHouse#103773 (yariks5s,
"Fix UB while parsing dateTime", merged 2026-04-30). This test PR
takes over @Avogar's stalled ClickHouse#102890 / closed ClickHouse#103717 by carrying
forward only the additional test cases — the .cpp fix from ClickHouse#102890
is now redundant.

Test cases:
  '12:34:56..123'                                  (double dot directly)
  '12:34:56.123.456'                               (extra dot after fractional)
  '12:34:56.123456789012345678.987654321'          (long fractional + dot)

Each tested against parseDateTime64BestEffort (strict),
parseDateTime64BestEffortOrNull, and parseDateTime64BestEffortOrZero.

Co-authored-by: avogar <[email protected]>
Co-authored-by: Pavel Kruglov <[email protected]>
Co-authored-by: Nihal Z. Miaji <[email protected]>
pull Bot pushed a commit to TCeason/ClickHouse that referenced this pull request May 6, 2026
…4-double-dot-test-takeover-v2

Add tests for parseDateTime64BestEffort duplicate fractional separator (takeover of ClickHouse#102890 / supersede ClickHouse#103717)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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