-
Notifications
You must be signed in to change notification settings - Fork 4k
ARROW-6572: [C++] Fix Parquet decoding returning uninitialized data #5392
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -738,7 +738,13 @@ Status TransferInt96(RecordReader* reader, MemoryPool* pool, | |
| RETURN_NOT_OK(::arrow::AllocateBuffer(pool, length * sizeof(int64_t), &data)); | ||
| auto data_ptr = reinterpret_cast<int64_t*>(data->mutable_data()); | ||
| for (int64_t i = 0; i < length; i++) { | ||
| *data_ptr++ = Int96GetNanoSeconds(values[i]); | ||
| if (values[i].value[2] == 0) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure I understand why 0 is an invalid value (I guess this is specific semantics of int96 type)?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not invalid per se, it just doesn't convert to a valid
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah, OK. |
||
| // Happens for null entries: avoid triggering UBSAN as that Int96 timestamp | ||
| // isn't representable as a 64-bit Unix timestamp. | ||
| *data_ptr++ = 0; | ||
| } else { | ||
| *data_ptr++ = Int96GetNanoSeconds(values[i]); | ||
| } | ||
| } | ||
| *out = std::make_shared<TimestampArray>(type, length, data, reader->ReleaseIsValid(), | ||
| reader->null_count()); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This causes
class-memaccesswarning with g++ 9.2.1:Can we use
T zero = {}instead ofmemset()here?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or is
memset(static_cast<void*>(&zero), 0, sizeof(T))better?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I didn't know that
T zero = {}caused zero initialization. We can use that then.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kou Do you want to submit a PR or should I do it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll do because I can confirm the fix locally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created: #5414