Repository navigation
GH-1261: Reject out-of-range dictionary indices in decode #1262
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -165,7 +165,7 @@ static void retrieveIndexVector( | |||||||||||||||||||||||||
| for (int i = start; i < end; i++) { | ||||||||||||||||||||||||||
| if (!indices.isNull(i)) { | ||||||||||||||||||||||||||
| int indexAsInt = (int) indices.getValueAsLong(i); | ||||||||||||||||||||||||||
| if (indexAsInt > dictionaryCount) { | ||||||||||||||||||||||||||
| if (indexAsInt < 0 || indexAsInt >= dictionaryCount) { | ||||||||||||||||||||||||||
| throw new IllegalArgumentException( | ||||||||||||||||||||||||||
| "Provided dictionary does not contain value for index " + indexAsInt); | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
Comment on lines
167
to
171
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The narrowing to Checking the
Suggested change
|
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This helper has a caller that doesn't pass a dictionary size.
StructSubfieldEncoder.decodecalls:where
valueCountis the struct's row count. With>=that gives two problems:f0child holds index 1 into a 2-entry dictionary["aa", "bb"]decodes on main and now throwsProvided dictionary does not contain value for index 1.39 >= 40and reachescopyValueSafe. For a fixed-width dictionary that ends in a rawMemoryUtil.copyMemoryinBaseFixedWidthVector.copyFrom.Could you pass
dictionary.getVector().getValueCount()inStructSubfieldEncoderinstead? The PR description says the struct decoder is covered by this change, which only holds once that bound is fixed.