Repository navigation
Conversation
For more than 6 byte widths, MakeSharedCappedKeySegmentsExtractor() returns a DynamicCappedKeySegmentsExtractor, whose constructor assigned ideal_ends_[i] without sizing the vector first. Creating such an extractor wrote past the end of an empty vector (a segfault in DBBloomFilterTest), and Extract() would have returned no segments. Size ideal_ends_ before filling it, and cover a 7-width extractor in DBBloomFilterTest.FixedWidthSegments.
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
MakeSharedCappedKeySegmentsExtractor()crashes for more than 6 byte widths:For 0 to 6 widths it returns a
SemiStaticCappedKeySegmentsExtractor<N>(astd::array). For more it returns aDynamicCappedKeySegmentsExtractor, whose constructor assignsideal_ends_[i]whileideal_ends_is still an emptystd::vector, so it writes past the end of the vector. If it did not crash,Extract()would return no segments, since it copiesideal_ends_.The fix sizes
ideal_ends_before filling it.Test plan
DBBloomFilterTest.FixedWidthSegmentsnow also covers a 7-width extractor ({1, 2, 0, 1, 1, 1, 1}): its id, and the extracted segment sizes for an empty key, a short key, an exact-length key and a longer key, matching the 4-width cases already there.FixedWidthSegmentsandSstQueryFilterpass.Debug build, clang 21. Independent of #15523, which fixes the decoding of
SelectKeySegmentRangein the same file.This issue was found by an LLM-Enhanced Static Analysis Engine and verified manually.