leerho opened a new pull request, #563: URL: https://github.com/apache/datasketches-cpp/pull/563
`tdigest::serialize(header_size_bytes, with_buffer)` allocated `get_serialized_size_bytes(with_buffer)` bytes but wrote the sketch starting at `header_size_bytes`, so with a non-zero header the last `header_size_bytes` bytes were written past the end of the vector. The vector is now `header_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 header` case in `tdigest_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 plus `get_serialized_size_bytes()`, the bytes after the header match `serialize()` 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](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
