[ 
https://issues.apache.org/jira/browse/ARROW-2822?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16538516#comment-16538516
 ] 

Dimitri Vorona commented on ARROW-2822:
---------------------------------------

I ended up leaving Buffer::Resize unchanged and explicitly calling ZeroPadding 
where appropriate. We maybe need a note about preferring AllocateBuffer to 
make_shared+Resize.

I also added the finish check we've talked about.

There is a place in glib where IMHO we should explicitly zero the padding, too, 
but since I'm not comfortable with that part of arrow, I'd like for someone to 
look at the change first:

{{diff --git a/c_glib/arrow-glib/input-stream.cpp 
b/c_glib/arrow-glib/input-stream.cpp}}
{{index 353d00a8..fa899fbe 100644}}
{{--- a/c_glib/arrow-glib/input-stream.cpp}}
{{+++ b/c_glib/arrow-glib/input-stream.cpp}}
{{@@ -551,6 +551,7 @@ namespace garrow {}}
{{ if (n_read_bytes < n_bytes) {}}
{{ RETURN_NOT_OK(buffer->Resize(n_read_bytes));}}
{{ }}}
{{+ buffer->ZeroPadding();}}
{{ *out = buffer;}}
{{ return arrow::Status::OK();}}
{{ }}}

The rest of the changes are in the PR.

I just noticed that python raises some warnings about unfinished buffers, too. 
I can fix those, though no today.

> [C++] Zero padding bytes in PoolBuffer::Resize
> ----------------------------------------------
>
>                 Key: ARROW-2822
>                 URL: https://issues.apache.org/jira/browse/ARROW-2822
>             Project: Apache Arrow
>          Issue Type: Improvement
>          Components: C++
>            Reporter: Wes McKinney
>            Priority: Major
>
> This is a possible proposed fix which would supersede some of the changes 
> made in ARROW-2790 as elsewhere.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to