jpegdec: Prevent crash when reading image with problems
authorThiago Santos <thiago.sousa.santos@collabora.co.uk>
Thu, 19 Aug 2010 21:30:05 +0000 (18:30 -0300)
committerThiago Santos <thiago.sousa.santos@collabora.co.uk>
Thu, 19 Aug 2010 21:30:05 +0000 (18:30 -0300)
Check if we have data on the adapter and fail if not.

Fixes #627413

ext/jpeg/gstjpegdec.c

index 0e90819..333658e 100644 (file)
@@ -211,6 +211,11 @@ gst_jpeg_dec_fill_input_buffer (j_decompress_ptr cinfo)
   GST_DEBUG_OBJECT (dec, "fill_input_buffer: fast av=%u, remaining=%u", av,
       dec->rem_img_len);
 
+  if (av == 0) {
+    GST_DEBUG_OBJECT (dec, "Out of data");
+    return FALSE;
+  }
+
   if (dec->rem_img_len < av)
     av = dec->rem_img_len;
   dec->rem_img_len -= av;