[
https://issues.apache.org/jira/browse/ARROW-2275?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16392992#comment-16392992
]
ASF GitHub Bot commented on ARROW-2275:
---------------------------------------
wesm commented on a change in pull request #1717: ARROW-2275: [C++] Guard
against bad use of Buffer.mutable_data()
URL: https://github.com/apache/arrow/pull/1717#discussion_r173478919
##########
File path: cpp/src/arrow/buffer.h
##########
@@ -54,7 +54,11 @@ class ARROW_EXPORT Buffer {
///
/// \note The passed memory must be kept alive through some other means
Buffer(const uint8_t* data, int64_t size)
- : is_mutable_(false), data_(data), size_(size), capacity_(size) {}
+ : is_mutable_(false),
+ data_(data),
+ mutable_data_(nullptr),
Review comment:
We need to use the NULLPTR macro here
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> [C++] Buffer::mutable_data_ member uninitialized
> ------------------------------------------------
>
> Key: ARROW-2275
> URL: https://issues.apache.org/jira/browse/ARROW-2275
> Project: Apache Arrow
> Issue Type: Bug
> Components: C++
> Affects Versions: 0.8.0
> Reporter: Antoine Pitrou
> Priority: Minor
> Labels: pull-request-available
>
> For immutable buffers (i.e. most of them), the {{mutable_data_}} member is
> uninitialized. If the user calls {{mutable_data()}} by mistake on such a
> buffer, they will get a bogus pointer back.
> This is exacerbated by the Tensor API whose const and non-const
> {{raw_data()}} methods return different things...
> (also an idea: add a DCHECK for mutability before returning from
> {{mutable_data()}}?)
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)