From 6b2a0c7c46616f8148e846a17f5675b0000f07cf Mon Sep 17 00:00:00 2001 From: Tim-Philipp Müller Date: Sun, 25 Apr 2010 15:12:20 +0100 Subject: 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. --- ext/jpeg/gstjpegdec.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'ext/jpeg/gstjpegdec.c') 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 -- cgit v1.2.3