Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/lib_ccx/ccx_common_option.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ void init_options(struct ccx_s_options *options)
options->settings_dtvcc.print_file_reports = 1;
options->settings_dtvcc.no_rollup = 0;
options->settings_dtvcc.report = NULL;
options->settings_dtvcc.timing = NULL;
memset(
options->settings_dtvcc.services_enabled, 0,
CCX_DTVCC_MAX_SERVICES * sizeof(options->settings_dtvcc.services_enabled[0]));
Expand Down
10 changes: 10 additions & 0 deletions src/rust/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,18 @@ pub unsafe fn copy_from_rust(ccx_s_options: *mut ccx_s_options, options: Options
(*ccx_s_options).extraction_start = options.extraction_start.to_ctype();
(*ccx_s_options).extraction_end = options.extraction_end.to_ctype();
(*ccx_s_options).print_file_reports = options.print_file_reports as _;
// Preserve the original C-managed report pointer to avoid dangling pointer issues.
let saved_608_report = (*ccx_s_options).settings_608.report;
(*ccx_s_options).settings_608 = options.settings_608.to_ctype();
(*ccx_s_options).settings_608.report = saved_608_report;
// Preserve the original C-managed report and timing pointers to avoid dangling pointer issues.
// These pointers are allocated and managed by C code (init_libraries, init_cc_decode),
// and to_ctype() would create temporary stack values that become dangling.
let saved_report = (*ccx_s_options).settings_dtvcc.report;
let saved_timing = (*ccx_s_options).settings_dtvcc.timing;
(*ccx_s_options).settings_dtvcc = options.settings_dtvcc.to_ctype();
(*ccx_s_options).settings_dtvcc.report = saved_report;
(*ccx_s_options).settings_dtvcc.timing = saved_timing;
(*ccx_s_options).is_608_enabled = options.is_608_enabled as _;
(*ccx_s_options).is_708_enabled = options.is_708_enabled as _;
(*ccx_s_options).millis_separator = options.millis_separator() as _;
Expand Down
Loading