summaryrefslogtreecommitdiff
path: root/gst-libs
diff options
context:
space:
mode:
authorMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>2012-05-21 15:24:25 +0200
committerMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>2012-05-21 15:29:37 +0200
commite560ce0909693994e9b7e794f9904805c052ebcd (patch)
tree18dd54520a0aae598461f5d1def3e9ce967965eb /gst-libs
parentc0c8aaed21c5efe3aa8ddd5ae217376d00ca836d (diff)
downloadgstreamer-plugins-bad-e560ce0909693994e9b7e794f9904805c052ebcd.tar.gz
codecparsers: mpegvideoparser: fix buffer size check
... to mind unsigned integer wrap Based on patch by Alban Browaeys <prahal@yahoo.com> Fixes https://bugzilla.gnome.org/show_bug.cgi?id=673436
Diffstat (limited to 'gst-libs')
-rw-r--r--gst-libs/gst/codecparsers/gstmpegvideoparser.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/gst-libs/gst/codecparsers/gstmpegvideoparser.c b/gst-libs/gst/codecparsers/gstmpegvideoparser.c
index ec8c934bb..5c8426868 100644
--- a/gst-libs/gst/codecparsers/gstmpegvideoparser.c
+++ b/gst-libs/gst/codecparsers/gstmpegvideoparser.c
@@ -298,19 +298,19 @@ gst_mpeg_video_parse (const guint8 * data, gsize size, guint offset)
GstByteReader br;
GList *ret = NULL;
- size -= offset;
-
if (!initialized) {
GST_DEBUG_CATEGORY_INIT (mpegvideo_parser_debug, "codecparsers_mpegvideo",
0, "Mpegvideo parser library");
initialized = TRUE;
}
- if (size <= 0) {
+ if (size <= offset) {
GST_DEBUG ("Can't parse from offset %d, buffer is to small", offset);
return NULL;
}
+ size -= offset;
+
gst_byte_reader_init (&br, &data[offset], size);
off = scan_for_start_codes (&br, 0, size);