Copilot commented on code in PR #50807:
URL: https://github.com/apache/arrow/pull/50807#discussion_r3894585836
##########
cpp/src/parquet/arrow/reader_internal.cc:
##########
@@ -270,6 +270,15 @@ Status ByteArrayStatisticsAsScalars(const Statistics&
statistics,
return ExtractDecimalMinMaxFromBytes(statistics.EncodeMin(),
statistics.EncodeMax(),
*logical_type, min, max);
}
+ if (logical_type->type() == LogicalType::Type::FLOAT16) {
+ *min = std::make_shared<::arrow::HalfFloatScalar>(
+ ::arrow::util::Float16::FromLittleEndian(
+ reinterpret_cast<const uint8_t*>(statistics.EncodeMin().data())));
+ *max = std::make_shared<::arrow::HalfFloatScalar>(
+ ::arrow::util::Float16::FromLittleEndian(
+ reinterpret_cast<const uint8_t*>(statistics.EncodeMax().data())));
+ return Status::OK();
+ }
Review Comment:
FLOAT16 statistics decoding reads `EncodeMin()/EncodeMax()` bytes without
validating the encoded length. A malformed or truncated file could trigger
out-of-bounds reads here; it would be safer to check for exactly 2 bytes and
return an Invalid status otherwise.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]