Skip to content

Fix invalid access in BitArray#[](Int, Int) - #17205

Open
HertzDevil wants to merge 1 commit into
crystal-lang:masterfrom
HertzDevil:bug/bitarray-subrange
Open

Fix invalid access in BitArray#[](Int, Int)#17205
HertzDevil wants to merge 1 commit into
crystal-lang:masterfrom
HertzDevil:bug/bitarray-subrange

Conversation

@HertzDevil

Copy link
Copy Markdown
Contributor

Fixes #17202.

end_bit_index is an inclusive range end and had an off-by-one error. Also the implementation now involves less indexing by using pointers directly.

@HertzDevil HertzDevil added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:stdlib:collection labels Aug 10, 2026
@straight-shoota

Copy link
Copy Markdown
Member

bc5fce4 shouldn't be in this branch.

@HertzDevil
HertzDevil force-pushed the bug/bitarray-subrange branch from 33dd2b0 to d52e5c2 Compare August 10, 2026 22:58
@straight-shoota straight-shoota added this to the 1.22.0 milestone Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:stdlib:collection

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BitArray#[] can crash when slicing large bit arrays

2 participants