-
Notifications
You must be signed in to change notification settings - Fork 4k
GH-44690: [C++] NumericBuilder::AppendValues append vector prevent from ub #44794
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
Conversation
|
|
|
After merging your PR, Conbench analyzed the 3 benchmarking runs that have been run so far on merge-commit 501418e. There were no benchmark performance regressions. 🎉 The full Conbench report has more details. |
|
I think we take a systematic approach to this and make wrappers to This article [1] discusses the issue in detail and points to approaches taken by projects like [1] https://davidben.net/2024/01/15/empty-slices.html |
|
Well, we do have the arrow/cpp/src/arrow/util/ubsan.h Lines 46 to 53 in ae497bf
|
|
@felipecrv this would be a better solution, maybe I can move forward! |
I think it's a weird way to go about fixing this. It's easier to accept that |
|
I agree that |
|
Easy to forbid https://clang.llvm.org/extra/clang-tidy/checks/bugprone/unsafe-functions.html |
|
Hmm, perhaps that can be discussed on the dev ML? |
|
Let me draft a mail later tonight |
Rationale for this change
Add boundary check for
NumericBuilder::AppendValuesfor std::vectorOriginally, it will :
AppendValuesmight hasstd::vectoras arguments,std::vector::datamight be usedstd::vector::datamight returnsnullptrif size == 0: https://en.cppreference.com/w/cpp/container/vector/dataWhat changes are included in this PR?
Add boundary check for
NumericBuilder::AppendValuesfor std::vectorAre these changes tested?
Covered by existing
Are there any user-facing changes?
no
AppendValuescalled with empty vector #44690