Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix indexing bug in ZeroMap2d::insert #4160

Merged
merged 8 commits into from
Oct 18, 2023
Merged

Conversation

sffc
Copy link
Member

@sffc sffc commented Oct 14, 2023

Fixes #4161

Manishearth
Manishearth previously approved these changes Oct 16, 2023
@sffc sffc changed the title Add test case for erroneous ZeroMap2d construction Fix indexing bug in ZeroMap2d::insert Oct 18, 2023
@sffc sffc requested a review from Manishearth October 18, 2023 02:31
@sffc
Copy link
Member Author

sffc commented Oct 18, 2023

Found the bug and pushed a fix.

+ match self.keys1.zvl_binary_search_in_range(key1, range).unwrap() {
Ok(index) => return Some(self.values.zvl_replace(index, value)),
Ok(index) => return Some(self.values.zvl_replace(range_start + index, value)),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bug is here; it was overwriting the wrong value in the map.

@sffc
Copy link
Member Author

sffc commented Oct 18, 2023

I don't think we need a patch release since this is not a regression in behavior, but I would not oppose a patch release.

It appears cargo make testdata and cargo make bakeddata are both clean, so it seems luckily we hadn't been hitting this code path before at least in icu4x.

@sffc sffc merged commit e7cf3d7 into unicode-org:main Oct 18, 2023
28 checks passed
@sffc sffc deleted the zm2d-broken branch October 18, 2023 06:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ZeroMap2d::from_iter seems to be broken
2 participants