diff --git a/cpp/src/io/utilities/column_buffer.cpp b/cpp/src/io/utilities/column_buffer.cpp index e5d4e1a360f..27fc53fbc9e 100644 --- a/cpp/src/io/utilities/column_buffer.cpp +++ b/cpp/src/io/utilities/column_buffer.cpp @@ -191,6 +191,10 @@ std::unique_ptr make_column(column_buffer_base& buffer, auto data = col_content.data.release(); auto char_size = data->size(); + CUDF_EXPECTS(char_size < static_cast(std::numeric_limits::max()), + "Cannot convert strings column to lists column due to size_type limit", + std::overflow_error); + auto uint8_col = std::make_unique( data_type{type_id::UINT8}, char_size, std::move(*data), rmm::device_buffer{}, 0); diff --git a/cpp/src/reshape/byte_cast.cu b/cpp/src/reshape/byte_cast.cu index 1b05a9744fa..3dfa0b65814 100644 --- a/cpp/src/reshape/byte_cast.cu +++ b/cpp/src/reshape/byte_cast.cu @@ -135,9 +135,14 @@ struct byte_list_conversion_fn(input, stream, mr)->release(); - auto const num_chars = col_content.data->size(); - auto uint8_col = std::make_unique( + auto const num_chars = strings_column_view(input).chars_size(stream); + CUDF_EXPECTS(num_chars < static_cast(std::numeric_limits::max()), + "Cannot convert strings column to lists column due to size_type limit", + std::overflow_error); + + auto col_content = std::make_unique(input, stream, mr)->release(); + + auto uint8_col = std::make_unique( output_type, num_chars, std::move(*(col_content.data)), rmm::device_buffer{}, 0); auto result = make_lists_column(