Fix index out of bounds panic when map collection has odd items#412
Open
dkropachev wants to merge 1 commit intomasterfrom
Open
Fix index out of bounds panic when map collection has odd items#412dkropachev wants to merge 1 commit intomasterfrom
dkropachev wants to merge 1 commit intomasterfrom
Conversation
6ab67c4 to
67809e2
Compare
Lorak-mmk
requested changes
Feb 2, 2026
67809e2 to
7c72cbb
Compare
wprzytula
requested changes
Feb 2, 2026
Maps require key-value pairs, so an odd number of items is invalid. Changed From<&CassCollection> to TryFrom<&CassCollection> to return CASS_ERROR_LIB_INVALID_VALUE_TYPE for malformed map collections. Fixes #411
7c72cbb to
eb49e87
Compare
Contributor
Author
|
Regarding the review comment about returning an error instead of ignoring odd-item maps: Done. Changed the implementation to return an error:
|
wprzytula
approved these changes
Feb 3, 2026
Contributor
|
@dkropachev Please update the cover letter. |
Contributor
Author
done |
Contributor
Author
|
@Lorak-mmk , could you please review it ? |
Contributor
Author
|
Just in case, cicd failure not related to this PR. |
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
CassCqlValueconversion when a map has an odd number of items (missing value in a key-value pair)From<&CassCollection>toTryFrom<&CassCollection>forCassCqlValue, returningCassError::CASS_ERROR_LIB_INVALID_VALUE_TYPEinstead of panickingbinding.rsto usetry_into()to propagate the error to callerstracing::error!when an odd-item map is encounteredVec::with_capacityfor map pair allocationFixes #411
Test plan
cargo test collection::to verify all collection tests passmake check-cargo-clippy check-cargo-fmtto verify linting passes