From 4f2bcc324389fa32216baece1786389914f3a2f4 Mon Sep 17 00:00:00 2001 From: Mark Nauwelaerts Date: Tue, 28 Aug 2012 11:07:41 +0200 Subject: [PATCH] h264parse: ensure sufficiently sized buffer when wrapping NAL Noted by Fixes https://bugzilla.gnome.org/show_bug.cgi?id=682589 --- gst/videoparsers/gsth264parse.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gst/videoparsers/gsth264parse.c b/gst/videoparsers/gsth264parse.c index b14ea9c8b0..020f3c625f 100644 --- a/gst/videoparsers/gsth264parse.c +++ b/gst/videoparsers/gsth264parse.c @@ -375,7 +375,7 @@ gst_h264_parse_wrap_nal (GstH264Parse * h264parse, guint format, guint8 * data, GST_DEBUG_OBJECT (h264parse, "nal length %d", size); - buf = gst_buffer_new_allocate (NULL, nl + size, NULL); + buf = gst_buffer_new_allocate (NULL, 4 + size, NULL); if (format == GST_H264_PARSE_FORMAT_AVC) { tmp = GUINT32_TO_BE (size << (32 - 8 * nl)); } else { @@ -388,6 +388,7 @@ gst_h264_parse_wrap_nal (GstH264Parse * h264parse, guint format, guint8 * data, gst_buffer_fill (buf, 0, &tmp, sizeof (guint32)); gst_buffer_fill (buf, nl, data, size); + gst_buffer_set_size (buf, size + nl); return buf; }