forked from scylladb/seastar
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
core/circular_buffer: fix iterator comparison for wrapped-around indexes
Indexes into a circular buffer can wrap-around (under or overflow) by design. The code knows about this and it is handled correctly. One area which managed to shelter a related bug undetected is iterator comparison. Iterators are just thin wrappers around an index. The comparison operators simply compare the two indexes. This breaks when one of the two compared iterators wrapped around but the other didn't. To fix, we compare offsets compared to the begin iterator. A unit test reproducing the problem is also added. Signed-off-by: Botond Dénes <[email protected]> Message-Id: <[email protected]>
- Loading branch information
Showing
2 changed files
with
36 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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