Skip to content

Commit 7d95b05

Browse files
authored
fix: CEA-708 segmentation faults on MP4 files (#1729)
* fix: CEA-708 segmentation faults on MP4 files * chore: fix clippy errors
1 parent 6300bb7 commit 7d95b05

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

docs/CHANGES.TXT

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
1.0 (to be released)
22
-----------------
3+
- Fix: Segmentation faults on MP4 files with CEA-708 captions
34
- Refactor: Remove API structures from ccextractor
45
- New: Add Encoder Module to Rust
56
- Fix: Elementary stream regressions

src/lib_ccx/mp4.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,8 +416,6 @@ static int process_clcp(struct lib_ccx_ctx *ctx, struct encoder_ctx *enc_ctx,
416416
dbg_print(CCX_DMT_PARSE, "MP4-708: atom skipped (cc_type < 2)\n");
417417
continue;
418418
}
419-
// WARN: otherwise cea-708 will not work
420-
dec_ctx->dtvcc->encoder = (void *)enc_ctx;
421419
dtvcc_process_data(dec_ctx->dtvcc, (unsigned char *)temp);
422420
cb_708++;
423421
}
@@ -552,6 +550,9 @@ int processmp4(struct lib_ccx_ctx *ctx, struct ccx_s_mp4Cfg *cfg, char *file)
552550
if (enc_ctx)
553551
enc_ctx->timing = dec_ctx->timing;
554552

553+
// WARN: otherwise cea-708 will not work
554+
dec_ctx->dtvcc->encoder = (void *)enc_ctx;
555+
555556
memset(&dec_sub, 0, sizeof(dec_sub));
556557
mprint("Opening \'%s\': ", file);
557558
#ifdef MP4_DEBUG

src/rust/lib_ccxr/src/encoder/txt_helpers.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,10 +282,10 @@ pub fn get_str_basic(
282282
info!("WARNING: Encoding is not yet supported\n");
283283
out_buffer.clear();
284284
out_buffer.push(0);
285-
return 0;
285+
0
286286
} else {
287287
out_buffer.push(0);
288-
return len;
288+
len
289289
}
290290
}
291291

0 commit comments

Comments
 (0)