Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GH-44690: [C++] NumericBuilder::AppendValues append vector prevent fr…
…om ub (#44794) ### Rationale for this change Add boundary check for `NumericBuilder::AppendValues` for std::vector Originally, it will : 1. `AppendValues` might has `std::vector` as arguments, `std::vector::data` might be used 2. `std::vector::data` might returns `nullptr` if size == 0: https://en.cppreference.com/w/cpp/container/vector/data 3. https://en.cppreference.com/w/cpp/string/byte/memcpy memcpy says, "If either dest or src is an [invalid or null pointer](https://en.cppreference.com/w/cpp/language/pointer#Pointers), the behavior is undefined, even if count is zero." ### What changes are included in this PR? Add boundary check for `NumericBuilder::AppendValues` for std::vector ### Are these changes tested? Covered by existing ### Are there any user-facing changes? no * GitHub Issue: #44690 Authored-by: mwish <[email protected]> Signed-off-by: mwish <[email protected]>
- Loading branch information