From 9269bee9bd92ec82167f3b197f1a54f6474ab617 Mon Sep 17 00:00:00 2001 From: Stefan Sauer Date: Tue, 8 Oct 2013 09:13:50 +0200 Subject: [PATCH] videodecoder: don't overflow in bytes<->time conversion fps_n and _d values can be large and this can overflow a uint. Also fix copy'n'paste mistake in comments. --- gst-libs/gst/video/gstvideodecoder.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gst-libs/gst/video/gstvideodecoder.c b/gst-libs/gst/video/gstvideodecoder.c index 67582672d8..77853a481b 100644 --- a/gst-libs/gst/video/gstvideodecoder.c +++ b/gst-libs/gst/video/gstvideodecoder.c @@ -605,15 +605,15 @@ gst_video_rawvideo_convert (GstVideoCodecState * state, res = TRUE; } else if (src_format == GST_FORMAT_TIME && *dest_format == GST_FORMAT_BYTES && fps_d && vidsize) { - /* convert time to frames */ + /* convert time to bytes */ *dest_value = gst_util_uint64_scale (src_value, - fps_n * vidsize, GST_SECOND * fps_d); + fps_n * (guint64) vidsize, GST_SECOND * fps_d); res = TRUE; } else if (src_format == GST_FORMAT_BYTES && *dest_format == GST_FORMAT_TIME && fps_n && vidsize) { - /* convert frames to time */ + /* convert bytes to time */ *dest_value = gst_util_uint64_scale (src_value, - GST_SECOND * fps_d, fps_n * vidsize); + GST_SECOND * fps_d, fps_n * (guint64) vidsize); res = TRUE; }