From 152813e71de9c634e29be5b1160d94fc09150437 Mon Sep 17 00:00:00 2001 From: Mathieu Duponchelle Date: Thu, 12 Aug 2021 20:39:24 +0200 Subject: [PATCH] ccconverter: fix overflow when not doing framerate conversion When converting from one framerate to another, counters are reset periodically, however when not converting they never are and can_genearte_output ends up making overflow-prone calculations with large values for input_frames and output_frames. Part-of: --- ext/closedcaption/gstccconverter.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ext/closedcaption/gstccconverter.c b/ext/closedcaption/gstccconverter.c index c7a3ef5ccd..08a1e7fd9a 100644 --- a/ext/closedcaption/gstccconverter.c +++ b/ext/closedcaption/gstccconverter.c @@ -884,6 +884,12 @@ fit_and_scale_cc_data (GstCCConverter * self, if (tc && tc->config.fps_n != 0) interpolate_time_code_with_framerate (self, tc, out_fps_entry->fps_n, out_fps_entry->fps_d, 1, 1, &self->current_output_timecode); + + self->scratch_ccp_len = 0; + self->scratch_cea608_1_len = 0; + self->scratch_cea608_2_len = 0; + self->input_frames = 0; + self->output_frames = 0; } else { int input_frame_n, input_frame_d, output_frame_n, output_frame_d; int output_time_cmp, scale_n, scale_d, rate_cmp;