Skip to content

fix intermittent failure in HeapVectorTypes.SimpleSetTest#2554

Open
ahornby wants to merge 1 commit into
facebook:mainfrom
ahornby:export-D88592733
Open

fix intermittent failure in HeapVectorTypes.SimpleSetTest#2554
ahornby wants to merge 1 commit into
facebook:mainfrom
ahornby:export-D88592733

Conversation

@ahornby

@ahornby ahornby commented Jan 12, 2026

Copy link
Copy Markdown
Contributor

Summary:
Fix intermittent failure in HeapVectorTypes.SimpleSetTest. When 32 isn’t present and all elements are <32, lower_bound(32) legitimately returns end(). The test immediately did if (*it == 32), which dereferences an end iterator, causing UB.

Added a guard it == s2.end() before dereferencing.

There was also flakiness if 32 is present and if s2.lower_bound(32); returned a lower value than 32 as then 32 not erased. Fixed by explicity erasing 32 before insert

Differential Revision: D88592733

Summary:
Fix intermittent failure in HeapVectorTypes.SimpleSetTest.  When 32 isn’t present and all elements are <32, lower_bound(32) legitimately returns end(). The test immediately did if (*it == 32), which dereferences an end iterator, causing UB.

Added a guard it == s2.end() before dereferencing.

There was also flakiness if 32 is present and if s2.lower_bound(32); returned a lower value than 32 as then 32 not erased.  Fixed by explicity erasing 32 before insert

Differential Revision: D88592733
@meta-cla meta-cla Bot added the CLA Signed label Jan 12, 2026
@meta-codesync

meta-codesync Bot commented Jan 12, 2026

Copy link
Copy Markdown

@ahornby has exported this pull request. If you are a Meta employee, you can view the originating Diff in D88592733.

ahornby added a commit to ahornby/folly that referenced this pull request Jan 12, 2026
)

Summary:

Fix intermittent failure in HeapVectorTypes.SimpleSetTest.  When 32 isn’t present and all elements are <32, lower_bound(32) legitimately returns end(). The test immediately did if (*it == 32), which dereferences an end iterator, causing UB.

Added a guard it == s2.end() before dereferencing.

There was also flakiness if 32 is present and if s2.lower_bound(32); returned a lower value than 32 as then 32 not erased.  Fixed by explicity erasing 32 before insert

Differential Revision: D88592733
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment