Repository navigation
Conversation
Empty serial version 3 compact images were accepted on the empty flag alone. They are now checked with the same mask and test values as Java EmptyCompactSketch: preamble longs, serial version, sketch type, bytes 3 and 4 zero, and the read-only, empty, compact, single-item and reserved flag bits. The ordered flag is ignored, since C++ before 3.3.0 and Java before 1.0.0 wrote empty images without it. The legacy 24-byte empty form (preamble longs 3) written by Java before 1.0.0 for sketches with p < 1 is accepted if it has no entries and carries the expected seed hash. The stream deserializer now reads the whole legacy image instead of stopping after the first 8 bytes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Coverage Report for CI Build 37711570993Coverage increased (+0.03%) to 82.409%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
This branch has not been deployed
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
C++ accepted any serial version 3 compact image with the empty flag set, without checking the rest of the preamble. This PR applies the same check as Java
EmptyCompactSketch(apache/datasketches-java#776), using the same mask and test values, so both languages accept and reject the same empty images.0x0000EFFFFFFFFFFF0x00000E00000303010x00000E0000030303Changes
compact_theta_sketch_parser::check_empty_v3, used byparse(bytedeserializeandwrap) and by streamdeserialize_v3.deserialize_v3now reads all 24 bytes instead of stopping after 8.Behavior change for users: empty images with non-zero bytes 3 and 4, read-only or compact missing, single-item or a reserved bit set, preamble longs 2, or a malformed legacy form are now rejected. No C++ or Java release I tested writes any of these.
Testing
deserialize, bytedeserializeandwrap.🤖 Generated with Claude Code