Fix use-of-uninitialized-value in formatDateTime#96133
Merged
alexey-milovidov merged 2 commits intomasterfrom Feb 6, 2026
Merged
Fix use-of-uninitialized-value in formatDateTime#96133alexey-milovidov merged 2 commits intomasterfrom
formatDateTime#96133alexey-milovidov merged 2 commits intomasterfrom
Conversation
`mysqlFractionalSecondScaleNumDigits` and `mysqlFractionalSecondSingleZero` used `dest[i-1] += fractional_second % 10` which reads the destination byte before writing. When the output buffer is not pre-filled with the template (variable-width formatters path, e.g. format string contains `%M`), this reads uninitialized memory. Also fix `jodaFractionOfSecond` where `toString(fractional_second)` does not preserve leading zeros (e.g. fractional_second=5, scale=3 gives "5" instead of "005"), leaving the buffer partially uninitialized. Report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=172a57f2ad219399818d551a89e2d32d62f88ccf&name_0=MasterCI&name_1=Stress%20test%20%28azure%2C%20amd_msan%29 Co-Authored-By: Claude Opus 4.6 <[email protected]>
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Contributor
|
Workflow [PR], commit [7fe6c77] Summary: ❌
|
robot-clickhouse
added a commit
that referenced
this pull request
Feb 6, 2026
This was referenced Feb 6, 2026
robot-clickhouse
added a commit
that referenced
this pull request
Feb 6, 2026
This was referenced Feb 6, 2026
robot-clickhouse
added a commit
that referenced
this pull request
Feb 6, 2026
This was referenced Feb 6, 2026
robot-clickhouse
added a commit
that referenced
this pull request
Feb 6, 2026
This was referenced Feb 6, 2026
robot-clickhouse
added a commit
that referenced
this pull request
Feb 6, 2026
clickhouse-gh bot
added a commit
that referenced
this pull request
Feb 6, 2026
Backport #96133 to 26.1: Fix use-of-uninitialized-value in `formatDateTime`
clickhouse-gh bot
added a commit
that referenced
this pull request
Feb 6, 2026
Backport #96133 to 25.11: Fix use-of-uninitialized-value in `formatDateTime`
alexey-milovidov
added a commit
that referenced
this pull request
Feb 6, 2026
Backport #96133 to 25.12: Fix use-of-uninitialized-value in `formatDateTime`
alexey-milovidov
added a commit
that referenced
this pull request
Mar 17, 2026
Backport #96133 to 25.8: Fix use-of-uninitialized-value in `formatDateTime`
alexey-milovidov
added a commit
that referenced
this pull request
Mar 17, 2026
Backport #96133 to 25.3: Fix use-of-uninitialized-value in `formatDateTime`
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.
mysqlFractionalSecondScaleNumDigitsandmysqlFractionalSecondSingleZerouseddest[i-1] += fractional_second % 10which reads the destination byte before writing. When the output buffer is not pre-filled with the template (variable-width formatters path, e.g. format string contains%M), this reads uninitialized memory.Also fix
jodaFractionOfSecondwheretoString(fractional_second)does not preserve leading zeros (e.g. fractional_second=5, scale=3 gives "5" instead of "005"), leaving the buffer partially uninitialized.Report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=172a57f2ad219399818d551a89e2d32d62f88ccf&name_0=MasterCI&name_1=Stress%20test%20%28azure%2C%20amd_msan%29
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix use-of-uninitialized-value in
formatDateTimewith non-fixed-width formatters, such as MySQL and JODA-style.