wgtmac commented on code in PR #48745:
URL: https://github.com/apache/arrow/pull/48745#discussion_r2672005660
##########
cpp/src/parquet/statistics.cc:
##########
@@ -890,7 +890,10 @@ inline void TypedStatisticsImpl<ByteArrayType>::Copy(const
ByteArray& src, ByteA
ResizableBuffer* buffer) {
if (dst->ptr == src.ptr) return;
PARQUET_THROW_NOT_OK(buffer->Resize(src.len, false));
- std::memcpy(buffer->mutable_data(), src.ptr, src.len);
+ // Avoid calling memcpy with nullptr which is undefined behavior
+ if (src.len > 0) {
+ std::memcpy(buffer->mutable_data(), src.ptr, src.len);
+ }
Review Comment:
```suggestion
if (src.len > 0) {
memcpy(buffer->mutable_data(), src.ptr, src.len);
}
```
Let's skip the obvious comment and use `memcpy` consistently (I know you
just want to keep the its original behavior).
--
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]