summaryrefslogtreecommitdiff
authorThiago Santos <thiago.sousa.santos@collabora.co.uk>2009-12-26 19:59:14 (GMT)
committer Thiago Santos <thiago.sousa.santos@collabora.co.uk>2009-12-26 19:59:14 (GMT)
commit173be1422c4942fcd30c5e8afd9496027dfd2dfa (patch) (side-by-side diff)
treef67878a65b04e6f3a922db7c40b881ec9c14858c
parent362785df8843acc0e4276a0c611add3bf01d5a1f (diff)
downloadgst-plugins-good-173be1422c4942fcd30c5e8afd9496027dfd2dfa.zip
gst-plugins-good-173be1422c4942fcd30c5e8afd9496027dfd2dfa.tar.gz
audiofxbasefirfilter: do not try to alloc really large buffers
When nsamples_out is larger than nsamples_in, using unsigned ints lead to a overflow and the resulting value is wrong and way too large for allocating a buffer. Use signed integers and returning immediatelly when that happens.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--gst/audiofx/audiofxbasefirfilter.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gst/audiofx/audiofxbasefirfilter.c b/gst/audiofx/audiofxbasefirfilter.c
index bb2e5e6..fde7fb4 100644
--- a/gst/audiofx/audiofxbasefirfilter.c
+++ b/gst/audiofx/audiofxbasefirfilter.c
@@ -603,7 +603,7 @@ gst_audio_fx_base_fir_filter_push_residue (GstAudioFXBaseFIRFilter * self)
gint rate = GST_AUDIO_FILTER_CAST (self)->format.rate;
gint channels = GST_AUDIO_FILTER_CAST (self)->format.channels;
gint width = GST_AUDIO_FILTER_CAST (self)->format.width / 8;
- guint outsize, outsamples;
+ gint outsize, outsamples;
guint8 *in, *out;
if (channels == 0 || rate == 0 || self->nsamples_in == 0) {
@@ -616,7 +616,7 @@ gst_audio_fx_base_fir_filter_push_residue (GstAudioFXBaseFIRFilter * self)
/* Calculate the number of samples and their memory size that
* should be pushed from the residue */
outsamples = self->nsamples_in - (self->nsamples_out - self->latency);
- if (outsamples == 0) {
+ if (outsamples <= 0) {
self->buffer_fill = 0;
g_free (self->buffer);
self->buffer = NULL;