Repository navigation
Conversation
The ColumnArray constructor rejects decreasing offsets and a nested column whose size differs from the last offset, but ColumnArray::LoadBody checked neither. With decreasing offsets from the server, GetSize() and GetAsColumn() computed offsets[n] - offsets[n - 1] with unsigned wraparound; for Array(Nothing), whose Slice() keeps any length, a row then reported a length near 2^64. LoadBody now throws a ProtocolError on a decreasing offset and when the nested column does not hold exactly as many values as the last offset. When there are no rows or every array is empty it clears the stale nested values instead of returning early, so a reused column keeps that invariant too.
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.
The
ColumnArrayconstructor rejects decreasing offsets and a nested column whose size differs from the last offset, butColumnArray::LoadBodychecks neither. With decreasing offsets from the server,GetSize()andGetAsColumn()computeoffsets[n] - offsets[n - 1]with unsigned wraparound. ForArray(Nothing), whoseSlice()keeps any length, a row then reports a length near 2^64.Fix:
LoadBodythrowsProtocolErroron a decreasing offset, and when the nested column doesn't hold exactly as many values as the last offset. When there are no rows, or every array is empty, it clears the stale nested values instead of returning early, so a reused column keeps the same invariant.Reproducer: an
Array(Nothing)column with 2 rows and offsets[5, 2]. Another case isArray(FixedString(N)), where N times the row count wraps, with offsets[4]: the nested column then holds 0 values instead of 4.Tests:
ColumnArray.Load_DecreasingOffsets,Load_NestedSizeMismatch,Load_FixedStringNestedSizeMismatchandLoad_ReplacesPreviousRowsfail on master. Valid-offset and empty-array controls pass on both.