Skip to content

Commit

Permalink
bug-fix: cudf/io/json.hpp use after move (#16609)
Browse files Browse the repository at this point in the history
This PR fixes a use after move in json header.
The fix simply shifts the attributes to access the object value before moving it.
Closes #16608

Authors:
  - Nicolas (https://github.com/NicolasDenoyelle)

Approvers:
  - Bradley Dice (https://github.com/bdice)
  - David Wendt (https://github.com/davidwendt)
  - Muhammad Haseeb (https://github.com/mhaseeb123)

URL: #16609
  • Loading branch information
NicolasDenoyelle authored Aug 20, 2024
1 parent 3ac409d commit 2f7d354
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cpp/include/cudf/io/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,8 @@ class json_writer_options_builder;
class json_writer_options {
// Specify the sink to use for writer output
sink_info _sink;
// maximum number of rows to write in each chunk (limits memory use)
size_type _rows_per_chunk = std::numeric_limits<size_type>::max();
// Set of columns to output
table_view _table;
// string to use for null entries
Expand All @@ -704,8 +706,6 @@ class json_writer_options {
bool _include_nulls = false;
// Indicates whether to use JSON lines for records format
bool _lines = false;
// maximum number of rows to write in each chunk (limits memory use)
size_type _rows_per_chunk = std::numeric_limits<size_type>::max();
// string to use for values != 0 in INT8 types (default 'true')
std::string _true_value = std::string{"true"};
// string to use for values == 0 in INT8 types (default 'false')
Expand All @@ -720,7 +720,7 @@ class json_writer_options {
* @param table Table to be written to output
*/
explicit json_writer_options(sink_info sink, table_view table)
: _sink(std::move(sink)), _table(std::move(table)), _rows_per_chunk(table.num_rows())
: _sink(std::move(sink)), _rows_per_chunk(table.num_rows()), _table(std::move(table))
{
}

Expand Down

0 comments on commit 2f7d354

Please sign in to comment.