From: Matej Knopp Date: Mon, 29 Jul 2013 09:18:40 +0000 (+0200) Subject: qtdemux: Check for data size when parsing h264 codec data from strf atom X-Git-Tag: 1.19.3~509^2~5521 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=47ed79fb1c8dafbd7c721e3b9bfb7723f4be3174;p=platform%2Fupstream%2Fgstreamer.git qtdemux: Check for data size when parsing h264 codec data from strf atom --- diff --git a/gst/isomp4/qtdemux.c b/gst/isomp4/qtdemux.c index 75d69bb..f9aa3fd 100644 --- a/gst/isomp4/qtdemux.c +++ b/gst/isomp4/qtdemux.c @@ -7357,15 +7357,18 @@ qtdemux_parse_trak (GstQTDemux * qtdemux, GNode * trak) * are the fourcc, next 40 bytes are BITMAPINFOHEADER, * next 1 byte is the version, and the * subsequent bytes are sequence parameter set like data. */ - gst_codec_utils_h264_caps_set_level_and_profile (stream->caps, - avc_data + 8 + 40 + 1, size - 1); - buf = gst_buffer_new_and_alloc (size); - gst_buffer_fill (buf, 0, avc_data + 8 + 40, size); - gst_caps_set_simple (stream->caps, - "codec_data", GST_TYPE_BUFFER, buf, NULL); - gst_buffer_unref (buf); + size -= 40; /* we'll be skipping BITMAPINFOHEADER */ + if (size > 1) { + gst_codec_utils_h264_caps_set_level_and_profile (stream->caps, + avc_data + 8 + 40 + 1, size - 1); + buf = gst_buffer_new_and_alloc (size); + gst_buffer_fill (buf, 0, avc_data + 8 + 40, size); + gst_caps_set_simple (stream->caps, + "codec_data", GST_TYPE_BUFFER, buf, NULL); + gst_buffer_unref (buf); + } break; } case FOURCC_btrt: