From 43e4f3a727e258cbae5f8d3a8d9fd0b057595dd8 Mon Sep 17 00:00:00 2001 From: Mengkejiergeli Ba Date: Wed, 15 Feb 2023 13:10:39 +0800 Subject: [PATCH] h265parse: Fix to check returned value Part-of: --- .../gst/videoparsers/gsth265parse.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/subprojects/gst-plugins-bad/gst/videoparsers/gsth265parse.c b/subprojects/gst-plugins-bad/gst/videoparsers/gsth265parse.c index ec81c543d0..76f2a5f3a2 100644 --- a/subprojects/gst-plugins-bad/gst/videoparsers/gsth265parse.c +++ b/subprojects/gst-plugins-bad/gst/videoparsers/gsth265parse.c @@ -2170,10 +2170,16 @@ gst_h265_parse_update_src_caps (GstH265Parse * h265parse, GstCaps * caps) && h265parse->parsed_framerate) { gint new_fps_num, new_fps_den; - gst_util_fraction_multiply (fps_num, fps_den, 1, 2, &new_fps_num, - &new_fps_den); - fps_num = new_fps_num; - fps_den = new_fps_den; + if (!gst_util_fraction_multiply (fps_num, fps_den, 1, 2, &new_fps_num, + &new_fps_den)) { + GST_WARNING_OBJECT (h265parse, "Error calculating the new framerate" + " - integer overflow; setting it to 0/1"); + fps_num = 0; + fps_den = 1; + } else { + fps_num = new_fps_num; + fps_den = new_fps_den; + } h265parse->parsed_framerate = FALSE; } }