From 9e5f9ecc652b9174a7c5b18feb2f56a569410700 Mon Sep 17 00:00:00 2001 From: David Wendt Date: Fri, 3 May 2024 14:07:15 -0400 Subject: [PATCH] Check row limit size in cudf::strings::join_strings --- cpp/src/strings/combine/join.cu | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/cpp/src/strings/combine/join.cu b/cpp/src/strings/combine/join.cu index 4b2996a77e4..2e30e01df21 100644 --- a/cpp/src/strings/combine/join.cu +++ b/cpp/src/strings/combine/join.cu @@ -162,16 +162,16 @@ std::unique_ptr join_strings(strings_column_view const& input, return std::move(*chars_data); }(); + // API returns a single output row which cannot exceed row limit(max of size_type). + CUDF_EXPECTS(chars.size() < static_cast(std::numeric_limits::max()), + "The output exceeds the row size limit", + std::overflow_error); + // build the offsets: single string output has offsets [0,chars-size] auto offsets_column = [&] { - if (chars.size() < static_cast(get_offset64_threshold())) { - auto offsets32 = cudf::detail::make_device_uvector_async( - std::vector({0, static_cast(chars.size())}), stream, mr); - return std::make_unique(std::move(offsets32), rmm::device_buffer{}, 0); - } - auto offsets64 = cudf::detail::make_device_uvector_async( - std::vector({0L, static_cast(chars.size())}), stream, mr); - return std::make_unique(std::move(offsets64), rmm::device_buffer{}, 0); + auto offsets = cudf::detail::make_device_uvector_async( + std::vector({0, static_cast(chars.size())}), stream, mr); + return std::make_unique(std::move(offsets), rmm::device_buffer{}, 0); }(); // build the null mask: only one output row so it is either all-valid or all-null