gh-155850: Fix array unpickling of odd-length 'w' arrays across endianness - #155851
Open
tonghuaroot wants to merge 2 commits into
Open
gh-155850: Fix array unpickling of odd-length 'w' arrays across endianness#155851tonghuaroot wants to merge 2 commits into
tonghuaroot wants to merge 2 commits into
Conversation
… endianness mformat_descriptors stored a wrong item size for the UTF-16 (4, should be 2) and UTF-32 (8, should be 4) machine formats. The field gates the cross-endian unpickling length check, so an odd-length 'w' array pickled on an opposite- endian machine was rejected with ValueError.
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.
mformat_descriptorsstores the byte size of one item, but the UTF-16 rowssaid 4 (actual: 2) and the UTF-32 rows said 8 (actual: 4). The field's only
consumer is the length check on the cross-endian unpickling path, so an
odd-length
'w'array pickled on an opposite-endian machine was rejectedwith
ValueError: string length not a multiple of item size. The existingtest_unicodeused an even-length string; it now also covers an odd length.