Skip to content

Commit

Permalink
Fix UB
Browse files Browse the repository at this point in the history
  • Loading branch information
WillAyd committed Sep 4, 2024
1 parent f83b2e9 commit 7a28a45
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/nanoarrow/common/inline_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -289,12 +289,12 @@ static inline ArrowErrorCode ArrowBufferAppendBufferView(struct ArrowBuffer* buf

static inline ArrowErrorCode ArrowBufferAppendFill(struct ArrowBuffer* buffer,
uint8_t value, int64_t size_bytes) {
NANOARROW_RETURN_NOT_OK(ArrowBufferReserve(buffer, size_bytes));

if (size_bytes == 0) {
return NANOARROW_OK;
}

NANOARROW_RETURN_NOT_OK(ArrowBufferReserve(buffer, size_bytes));

memset(buffer->data + buffer->size_bytes, value, size_bytes);
buffer->size_bytes += size_bytes;
return NANOARROW_OK;
Expand Down

0 comments on commit 7a28a45

Please sign in to comment.