diff --git a/docs/CHANGES.TXT b/docs/CHANGES.TXT index b586d35b9..5587314e4 100644 --- a/docs/CHANGES.TXT +++ b/docs/CHANGES.TXT @@ -1,5 +1,6 @@ 1.0 (to be released) ----------------- +- Fix: Segmentation faults on MP4 files with CEA-708 captions - Refactor: Remove API structures from ccextractor - New: Add Encoder Module to Rust - Fix: Elementary stream regressions diff --git a/src/lib_ccx/mp4.c b/src/lib_ccx/mp4.c index 05df43fe0..6dd7f0d38 100644 --- a/src/lib_ccx/mp4.c +++ b/src/lib_ccx/mp4.c @@ -416,8 +416,6 @@ static int process_clcp(struct lib_ccx_ctx *ctx, struct encoder_ctx *enc_ctx, dbg_print(CCX_DMT_PARSE, "MP4-708: atom skipped (cc_type < 2)\n"); continue; } - // WARN: otherwise cea-708 will not work - dec_ctx->dtvcc->encoder = (void *)enc_ctx; dtvcc_process_data(dec_ctx->dtvcc, (unsigned char *)temp); cb_708++; } @@ -552,6 +550,9 @@ int processmp4(struct lib_ccx_ctx *ctx, struct ccx_s_mp4Cfg *cfg, char *file) if (enc_ctx) enc_ctx->timing = dec_ctx->timing; + // WARN: otherwise cea-708 will not work + dec_ctx->dtvcc->encoder = (void *)enc_ctx; + memset(&dec_sub, 0, sizeof(dec_sub)); mprint("Opening \'%s\': ", file); #ifdef MP4_DEBUG diff --git a/src/rust/lib_ccxr/src/encoder/txt_helpers.rs b/src/rust/lib_ccxr/src/encoder/txt_helpers.rs index a1986b9ee..8b2af4ff8 100644 --- a/src/rust/lib_ccxr/src/encoder/txt_helpers.rs +++ b/src/rust/lib_ccxr/src/encoder/txt_helpers.rs @@ -282,10 +282,10 @@ pub fn get_str_basic( info!("WARNING: Encoding is not yet supported\n"); out_buffer.clear(); out_buffer.push(0); - return 0; + 0 } else { out_buffer.push(0); - return len; + len } }