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.
This commit is contained in:
Sebastian Dröge 2008-10-08 11:50:50 +00:00
parent 947ecd72c4
commit c915582c17
2 changed files with 11 additions and 4 deletions

View file

@ -1,3 +1,10 @@
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>

View 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 */