Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Memory corruption in PartitionedOutput when keys are not a prefix of …
…input (facebookincubator#10075) Summary: Pull Request resolved: facebookincubator#10075 In PartitionedOutput's collectNullRows() function, it assumes that the key channels are a prefix of the input channels, i.e. the keys appear at the beginning of the input type. It allocates an std::vector of size equal to the number of key channels to hold DecodedVectors and assumes it can access these using the key channels as indices. When that assumption does not hold it accesses a DecodedVector off the end of that std::vector and writes to it, leading to memory corruption as it writes to arbitrary memory. The fix is to access the std::vector using the index of the keyChannel rather than the value of the keyChannel. This guarantees the std::vector is of minimal sufficient size and we do not read off the end of it. Note, this bug only happens if some of the keys are not a prefix of the input and replicateNullsAndAny is set and there are nulls one of the key columns that is not a prefix of the input. Reviewed By: xiaoxmeng Differential Revision: D58216159 fbshipit-source-id: 9809b12895369d3413485ab09eaafd9ddcac723b
- Loading branch information