avidemux: ensure sane parameters when parsing superindex

This commit is contained in:
Mark Nauwelaerts 2011-02-22 14:01:27 +01:00
parent d680842a7f
commit 940417edc3

View file

@ -1270,6 +1270,11 @@ gst_avi_demux_parse_superindex (GstAviDemux * avi,
GST_DEBUG_OBJECT (avi, "got %d indexes", num); 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); indexes = g_new (guint64, num + 1);
for (i = 0; i < num; i++) { for (i = 0; i < num; i++) {
if (size < 24 + bpe * (i + 1)) if (size < 24 + bpe * (i + 1))
@ -1293,6 +1298,14 @@ too_small:
gst_buffer_unref (buf); gst_buffer_unref (buf);
return FALSE; 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 /* add an entry to the index of a stream. @num should be an estimate of the