Skip to content

Commit 52d258b

Browse files
authored
GH-48234: [C++][Parquet] Fix overly strict check for BIT_PACKED levels byte size (#48235)
### Rationale for this change The original change from `data_size` to `data_size - 4` was made by me in #6848 and it was probably based on a misunderstanding, or just blindly copying the similar check for `Encoding::RLE` (which, unlike `Encoding::BIT_PACKED`, does have a 4-byte length header). ### Are these changes tested? Yes, by existing CI tests. ### Are there any user-facing changes? No, just a potential bugfix for an unlikely case. * GitHub Issue: #48234 Authored-by: Antoine Pitrou <[email protected]> Signed-off-by: Antoine Pitrou <[email protected]>
1 parent 0e2f4d8 commit 52d258b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cpp/src/parquet/column_reader.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ int LevelDecoder::SetData(Encoding::type encoding, int16_t max_level,
132132
"Number of buffered values too large (corrupt data page?)");
133133
}
134134
num_bytes = static_cast<int32_t>(bit_util::BytesForBits(num_bits));
135-
if (num_bytes < 0 || num_bytes > data_size - 4) {
135+
if (num_bytes < 0 || num_bytes > data_size) {
136136
throw ParquetException("Received invalid number of bytes (corrupt data page?)");
137137
}
138138
if (!bit_packed_decoder_) {

0 commit comments

Comments
 (0)