From c915582c17f420bd32b7d3538f95dfeb47ca51c2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 8 Oct 2008 11:50:50 +0000 Subject: [PATCH] gst/audioconvert/audioconvert.c: Prevent overflows with big buffer when calculating the size of the intermediate buff... Original commit message from CVS: * gst/audioconvert/audioconvert.c: (audio_convert_convert): Prevent overflows with big buffer when calculating the size of the intermediate buffer by using gst_util_uint64_scale() instead of plain arithmetics. Fixes bug #552801. --- ChangeLog | 7 +++++++ gst/audioconvert/audioconvert.c | 8 ++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index a6ade5e..78a5aab 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2008-10-08 Sebastian Dröge + * gst/audioconvert/audioconvert.c: (audio_convert_convert): + Prevent overflows with big buffer when calculating the size of + the intermediate buffer by using gst_util_uint64_scale() instead of + plain arithmetics. Fixes bug #552801. + +2008-10-08 Sebastian Dröge + Patch by: Pavel Zeldin * ext/pango/gstclockoverlay.c: (gst_clock_overlay_render_time), diff --git a/gst/audioconvert/audioconvert.c b/gst/audioconvert/audioconvert.c index f86665a..4780324 100644 --- a/gst/audioconvert/audioconvert.c +++ b/gst/audioconvert/audioconvert.c @@ -517,9 +517,9 @@ gboolean audio_convert_convert (AudioConvertCtx * ctx, gpointer src, gpointer dst, gint samples, gboolean src_writable) { - gint insize, outsize, size; + guint insize, outsize, size; gpointer outbuf, tmpbuf; - gint intemp = 0, outtemp = 0, biggest; + guint intemp = 0, outtemp = 0, biggest; g_return_val_if_fail (ctx != NULL, FALSE); g_return_val_if_fail (src != NULL, FALSE); @@ -537,9 +537,9 @@ audio_convert_convert (AudioConvertCtx * ctx, gpointer src, : sizeof (gint32); if (!ctx->in_default) - intemp = insize * size * 8 / ctx->in.width; + intemp = gst_util_uint64_scale (insize, size * 8, ctx->in.width); if (!ctx->mix_passthrough || !ctx->out_default) - outtemp = outsize * size * 8 / ctx->out.width; + outtemp = gst_util_uint64_scale (outsize, size * 8, ctx->out.width); biggest = MAX (intemp, outtemp); /* see if one of the buffers can be used as temp */ -- 2.7.4