Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-36913: [C++] Skip empty buffer concatenation to fix UBSan error #36914

Merged
merged 3 commits into from
Jul 27, 2023

Conversation

sfc-gh-ebrossard
Copy link
Contributor

@sfc-gh-ebrossard sfc-gh-ebrossard commented Jul 27, 2023

Rationale for this change

This is a trivial fix for a UBSan error in calls to ConcatenateBuffers with an empty buffer that has a null data pointer.

What changes are included in this PR?

Conditional call to std::memcpy based on whether the buffer's length is 0.

Are these changes tested?

Test added in buffer_test.cc.

Are there any user-facing changes?

No

@github-actions
Copy link

⚠️ GitHub issue #36913 has been automatically assigned in GitHub to PR creator.

@pitrou
Copy link
Member

pitrou commented Jul 27, 2023

Hi @sfc-gh-ebrossard and thank you for your contribution.

Please let me know if you'd like a test; I can add one to buffer_test.cc. I'm not sure if there are automated UBSan runs for Arrow unit tests.

Yes and yes. You'll find a "AMD64 Ubuntu 22.04 C++ ASAN UBSAN" CI job below.

Copy link
Member

@pitrou pitrou left a comment

Choose a reason for hiding this comment

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

Thanks a lot. LGTM except for one suggestion, see below.

@github-actions github-actions bot added awaiting committer review Awaiting committer review and removed awaiting review Awaiting review labels Jul 27, 2023
@pitrou
Copy link
Member

pitrou commented Jul 27, 2023

The Windows 2019 build failure is unrelated and appears on other PRs.

@pitrou pitrou merged commit bedc1e7 into apache:main Jul 27, 2023
33 of 34 checks passed
@pitrou pitrou removed the awaiting committer review Awaiting committer review label Jul 27, 2023
raulcd pushed a commit that referenced this pull request Jul 28, 2023
…36914)

### Rationale for this change

This is a trivial fix for a UBSan error in calls to `ConcatenateBuffers` with an empty buffer that has a null data pointer.

### What changes are included in this PR?

Conditional call to `std::memcpy` based on whether the buffer's length is 0.

### Are these changes tested?

Test added in buffer_test.cc.

### Are there any user-facing changes?

No
* Closes: #36913

Lead-authored-by: Elliott Brossard <[email protected]>
Co-authored-by: Elliott Brossard <[email protected]>
Co-authored-by: Antoine Pitrou <[email protected]>
Signed-off-by: Antoine Pitrou <[email protected]>
@conbench-apache-arrow
Copy link

After merging your PR, Conbench analyzed the 6 benchmarking runs that have been run so far on merge-commit bedc1e7.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details. It also includes information about possible false positives for unstable benchmarks that are known to sometimes produce them.

R-JunmingChen pushed a commit to R-JunmingChen/arrow that referenced this pull request Aug 20, 2023
…ror (apache#36914)

### Rationale for this change

This is a trivial fix for a UBSan error in calls to `ConcatenateBuffers` with an empty buffer that has a null data pointer.

### What changes are included in this PR?

Conditional call to `std::memcpy` based on whether the buffer's length is 0.

### Are these changes tested?

Test added in buffer_test.cc.

### Are there any user-facing changes?

No
* Closes: apache#36913

Lead-authored-by: Elliott Brossard <[email protected]>
Co-authored-by: Elliott Brossard <[email protected]>
Co-authored-by: Antoine Pitrou <[email protected]>
Signed-off-by: Antoine Pitrou <[email protected]>
loicalleyne pushed a commit to loicalleyne/arrow that referenced this pull request Nov 13, 2023
…ror (apache#36914)

### Rationale for this change

This is a trivial fix for a UBSan error in calls to `ConcatenateBuffers` with an empty buffer that has a null data pointer.

### What changes are included in this PR?

Conditional call to `std::memcpy` based on whether the buffer's length is 0.

### Are these changes tested?

Test added in buffer_test.cc.

### Are there any user-facing changes?

No
* Closes: apache#36913

Lead-authored-by: Elliott Brossard <[email protected]>
Co-authored-by: Elliott Brossard <[email protected]>
Co-authored-by: Antoine Pitrou <[email protected]>
Signed-off-by: Antoine Pitrou <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[C++] ConcatenateBuffers triggers a UBSan error when called with an empty buffer
2 participants