Repository navigation
Include the header in the tdigest serialize buffer size - #563
Merged
Merged
Conversation
tdigest::serialize(header_size_bytes, with_buffer) sized the vector by get_serialized_size_bytes() alone but wrote the sketch starting at header_size_bytes, so a non-zero header wrote past the end of the vector. The size now includes the header, as in the other sketches. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Coverage Report for CI Build 40966811038Coverage remained the same at 82.391%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
proost
approved these changes
Oct 30, 2026
proost
left a comment
Member
There was a problem hiding this comment.
Thank you!
This bug affect ds-psql too. After release ds-cpp, we also need new release ds-psql.
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.
tdigest::serialize(header_size_bytes, with_buffer)allocatedget_serialized_size_bytes(with_buffer)bytes but wrote the sketch starting atheader_size_bytes, so with a non-zero header the lastheader_size_bytesbytes were written past the end of the vector. The vector is nowheader_size_bytes + get_serialized_size_bytes(with_buffer)bytes, as in the other sketches (kll, req, var_opt, ebpps, count_min, bloom_filter, tuple, density).With the default header size of 0 the output is unchanged.
Tests
New
serialize bytes with headercase intdigest_test.cpp: for an empty sketch, a single value (with and without the buffer) and 10000 values (with and without the buffer), the serialized size is the header plusget_serialized_size_bytes(), the bytes after the header matchserialize()with no header, and the sketch deserializes from the bytes after the header. Under AddressSanitizer it reports a heap-buffer-overflow on master and passes here; all tdigest tests pass (macOS, Debug, ASan).🤖 Generated with Claude Code