gst/audioconvert/audioconvert.c: Prevent overflows with big buffer when calculating...
authorSebastian Dröge <slomo@circular-chaos.org>
Wed, 8 Oct 2008 11:50:50 +0000 (11:50 +0000)
committerSebastian Dröge <slomo@circular-chaos.org>
Wed, 8 Oct 2008 11:50:50 +0000 (11:50 +0000)
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
gst/audioconvert/audioconvert.c

index a6ade5e..78a5aab 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2008-10-08  Sebastian Dröge  <sebastian.droege@collabora.co.uk>
 
+       * 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  <sebastian.droege@collabora.co.uk>
+
        Patch by: Pavel Zeldin <pzeldin at gmail dot com>
 
        * ext/pango/gstclockoverlay.c: (gst_clock_overlay_render_time),
index f86665a..4780324 100644 (file)
@@ -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 */