Fix potential Divide by Zero panic#1665
Merged
kavirajk merged 6 commits intoClickHouse:mainfrom Sep 19, 2025
Merged
Conversation
The Svace static analyzer (https://www.ispras.ru/en/technologies/svace/) flagged this code as suspicious: it could lead to a panic (division by zero) when data is empty.
Signed-off-by: Kaviraj <[email protected]>
Contributor
Author
|
I'm figuring out a way to test this edge case via existing tests. |
This makes sure any internal state corruption leads to FixedString(0) wouldn't panic when trying to append value to the column. This is just there for defensive purpose. Originally you cannot create such column FixedString(0) because Clickhouse server already rejects such columns with zero size Signed-off-by: Kaviraj <[email protected]>
Contributor
Author
|
Ok. I think it's almost always not possible to reach a state with Also given the This patch is still valid to make sure we don't panic in case internal state corruption. So locking this behavior via unit test case only |
Signed-off-by: Kaviraj <[email protected]>
Signed-off-by: Kaviraj <[email protected]>
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.
Summary
This is based on existing #1643
Preserved the original author's commit. Just addressed the remark on top of it.
Checklist
Delete items not relevant to your PR: