From 6dae95d60f273e623cdfcb7ce80e9ee165947e92 Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Tue, 12 May 2020 16:05:01 +1000 Subject: [PATCH] ccconverter: check fraction multiply for overflow It should not happen and if it does, something went very wrong earlier CID 1463350 Part-of: --- ext/closedcaption/gstccconverter.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ext/closedcaption/gstccconverter.c b/ext/closedcaption/gstccconverter.c index f91d0a606a..f05bdb71d9 100644 --- a/ext/closedcaption/gstccconverter.c +++ b/ext/closedcaption/gstccconverter.c @@ -460,8 +460,10 @@ interpolate_time_code_with_framerate (GstCCConverter * self, if (!tc || tc->config.fps_n == 0) return FALSE; - gst_util_fraction_multiply (tc->frames, 1, scale_n, scale_d, &output_n, - &output_d); + if (!gst_util_fraction_multiply (tc->frames, 1, scale_n, scale_d, &output_n, + &output_d)) + /* we should never overflow */ + g_assert_not_reached (); tc_str = gst_video_time_code_to_string (tc); GST_TRACE_OBJECT (self, "interpolating time code %s with scale %d/%d "