summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2019-07-25 15:08:54 +0300
committerTim-Philipp Müller <tim@centricular.com>2019-08-08 13:31:11 +0100
commit360c40fbfdb3e880debf1c5f07246e54b3da5025 (patch)
treecf776584febd430ea5b4261ab3d9d234f607ecff
parent4e5d7165654bf8936dbb5ba220bb8e08d076c4e1 (diff)
downloadgstreamer-plugins-good-360c40fbfdb3e880debf1c5f07246e54b3da5025.tar.gz
jpegdec: Don't dereference NULL input state if we have no caps in TIME segments
Simply assume that the JPEG frame is not going to be interlaced instead of crashing.
-rw-r--r--ext/jpeg/gstjpegdec.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/ext/jpeg/gstjpegdec.c b/ext/jpeg/gstjpegdec.c
index d88b2583d..6c552290e 100644
--- a/ext/jpeg/gstjpegdec.c
+++ b/ext/jpeg/gstjpegdec.c
@@ -1250,6 +1250,7 @@ gst_jpeg_dec_handle_frame (GstVideoDecoder * bdec, GstVideoCodecFrame * frame)
/* is it interlaced MJPEG? (we really don't want to scan the jpeg data
* to see if there are two SOF markers in the packet to detect this) */
if (gst_video_decoder_get_packetized (bdec) &&
+ dec->input_state &&
dec->input_state->info.height > height &&
dec->input_state->info.height <= (height * 2)
&& dec->input_state->info.width == width) {
@@ -1304,6 +1305,9 @@ gst_jpeg_dec_handle_frame (GstVideoDecoder * bdec, GstVideoCodecFrame * frame)
if (num_fields == 2) {
GstVideoFormat field2_format;
+ /* Checked above before setting num_fields to 2 */
+ g_assert (dec->input_state != NULL);
+
/* skip any chunk or padding bytes before the next SOI marker; both fields
* are in one single buffer here, so direct access should be fine here */
while (dec->jsrc.pub.bytes_in_buffer > 2 &&