Skip to content

ARROW-2227: [Python] Fix off-by-one error in chunked binary conversions#1740

Closed
wesm wants to merge 2 commits intoapache:masterfrom
wesm:ARROW-2227
Closed

ARROW-2227: [Python] Fix off-by-one error in chunked binary conversions#1740
wesm wants to merge 2 commits intoapache:masterfrom
wesm:ARROW-2227

Conversation

@wesm
Copy link
Copy Markdown
Member

@wesm wesm commented Mar 13, 2018

We were already testing the chunked behavior but we did not exercise the off-by-one error edge case

Change-Id: Id92f3f41f552b9f0160e0df1b9e8db66fb28678e
using internal::NumPyTypeSize;

constexpr int64_t kBinaryMemoryLimit = std::numeric_limits<int32_t>::max();
constexpr int64_t kBinaryMemoryLimit = std::numeric_limits<int32_t>::max() - 1;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently this is already available as BinaryBuilder::kMaximumCapacity (though for some reason it's protected).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can move this constexpr to builder.h and use that consistently

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, there are several places in builder.cc that compare against std::numeric_limits<int32_t>::max() (with possible other off-by-one errors).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Change-Id: If38e28bc95319b8e24fe436f95c98e8a3c1f344c
@wesm
Copy link
Copy Markdown
Member Author

wesm commented Mar 13, 2018

Appveyor build: https://ci.appveyor.com/project/wesm/arrow/build/1.0.1770. Merging

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants