mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-02 05:28:48 +00:00
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
This commit is contained in:
parent
c0c8aaed21
commit
e560ce0909
1 changed files with 3 additions and 3 deletions
|
@ -298,19 +298,19 @@ gst_mpeg_video_parse (const guint8 * data, gsize size, guint offset)
|
||||||
GstByteReader br;
|
GstByteReader br;
|
||||||
GList *ret = NULL;
|
GList *ret = NULL;
|
||||||
|
|
||||||
size -= offset;
|
|
||||||
|
|
||||||
if (!initialized) {
|
if (!initialized) {
|
||||||
GST_DEBUG_CATEGORY_INIT (mpegvideo_parser_debug, "codecparsers_mpegvideo",
|
GST_DEBUG_CATEGORY_INIT (mpegvideo_parser_debug, "codecparsers_mpegvideo",
|
||||||
0, "Mpegvideo parser library");
|
0, "Mpegvideo parser library");
|
||||||
initialized = TRUE;
|
initialized = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (size <= 0) {
|
if (size <= offset) {
|
||||||
GST_DEBUG ("Can't parse from offset %d, buffer is to small", offset);
|
GST_DEBUG ("Can't parse from offset %d, buffer is to small", offset);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size -= offset;
|
||||||
|
|
||||||
gst_byte_reader_init (&br, &data[offset], size);
|
gst_byte_reader_init (&br, &data[offset], size);
|
||||||
|
|
||||||
off = scan_for_start_codes (&br, 0, size);
|
off = scan_for_start_codes (&br, 0, size);
|
||||||
|
|
Loading…
Reference in a new issue