You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "Antoine Pitrou (JIRA)" <ji...@apache.org> on 2019/01/03 18:52:00 UTC

[jira] [Commented] (ARROW-4150) [C++] Buffer data should never be null

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

Antoine Pitrou commented on ARROW-4150:
---------------------------------------

We have two possible solutions actually:
- follow standard malloc() conventions and return a different pointer everytime, even for 0-size allocations; this means allocating actual memory (probably in 64-byte increments if we want the right alignment)
- return the same pointer for all 0-size allocations, in which case we can simply return a statically-allocated piece of memory; this makes us non-malloc() compliant, but we don't pretend we are


> [C++] Buffer data should never be null
> --------------------------------------
>
>                 Key: ARROW-4150
>                 URL: https://issues.apache.org/jira/browse/ARROW-4150
>             Project: Apache Arrow
>          Issue Type: Wish
>          Components: C++
>    Affects Versions: 0.11.1
>            Reporter: Antoine Pitrou
>            Priority: Major
>
> When a 0-byte buffer is allocated, or at the start of a BufferBuilder, the buffer's data pointer can be null. This leads to passing null arguments (with zero sizes) to standard functions such as memset() and memcpy() in many places. UBSAN doesn't like it.
> Since a null pointer often means "failed allocating" or "programmer error", we might want to use a non-null pointer to a static empty piece of data instead.



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