diff --git a/gst/avi/gstavidemux.c b/gst/avi/gstavidemux.c index 0627710b6f..011eb7d1c5 100644 --- a/gst/avi/gstavidemux.c +++ b/gst/avi/gstavidemux.c @@ -1270,6 +1270,11 @@ gst_avi_demux_parse_superindex (GstAviDemux * avi, GST_DEBUG_OBJECT (avi, "got %d indexes", num); + /* this can't work out well ... */ + if (num > G_MAXUINT32 >> 1 || bpe < 8) { + goto invalid_params; + } + indexes = g_new (guint64, num + 1); for (i = 0; i < num; i++) { if (size < 24 + bpe * (i + 1)) @@ -1293,6 +1298,14 @@ too_small: gst_buffer_unref (buf); return FALSE; } +invalid_params: + { + GST_ERROR_OBJECT (avi, "invalid index parameters (num = %d, bpe = %d)", + num, bpe); + if (buf) + gst_buffer_unref (buf); + return FALSE; + } } /* add an entry to the index of a stream. @num should be an estimate of the