summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim.muller@collabora.co.uk>2010-04-25 15:12:20 +0100
committerTim-Philipp Müller <tim.muller@collabora.co.uk>2010-04-25 23:15:42 +0100
commit6b2a0c7c46616f8148e846a17f5675b0000f07cf (patch)
treedd48602724ac78b0362fd75e998f4eef5a233e6e
parent14e73d15dd1653db409587060043e06712839ebf (diff)
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.
-rw-r--r--ext/jpeg/gstjpegdec.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/ext/jpeg/gstjpegdec.c b/ext/jpeg/gstjpegdec.c
index cfdaec67b..7daec71c3 100644
--- a/ext/jpeg/gstjpegdec.c
+++ b/ext/jpeg/gstjpegdec.c
@@ -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