jpegdec: don't crash if jpeg image contains more than three components

Our code currently only handles a maximum of 3 components, so error
out for now if the image has more components than that.

Fixes #604106.
This commit is contained in:
Tim-Philipp Müller 2010-04-25 15:12:20 +01:00
parent 14e73d15dd
commit 6b2a0c7c46

View file

@ -1031,6 +1031,9 @@ gst_jpeg_dec_chain (GstPad * pad, GstBuffer * buf)
GST_LOG_OBJECT (dec, "num_components=%d", dec->cinfo.num_components);
GST_LOG_OBJECT (dec, "jpeg_color_space=%d", dec->cinfo.jpeg_color_space);
if (dec->cinfo.num_components > 3)
goto components_not_supported;
#ifndef GST_DISABLE_GST_DEBUG
{
gint i;
@ -1296,6 +1299,13 @@ drop_buffer:
ret = GST_FLOW_OK;
goto exit;
}
components_not_supported:
{
GST_ELEMENT_ERROR (dec, STREAM, DECODE, (NULL),
("more components than supported: %d > 3", dec->cinfo.num_components));
ret = GST_FLOW_ERROR;
goto done;
}
}
static gboolean