mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-20 15:27:07 +00:00
codecparsers: Add checks to input, and fix size checking
This commit is contained in:
parent
b142663ca5
commit
7d5bd1992e
1 changed files with 18 additions and 7 deletions
|
@ -324,7 +324,8 @@ gst_mpeg_video_parse (guint8 * data, gsize size, guint offset)
|
|||
gint off, rsize;
|
||||
GstByteReader br;
|
||||
GList *ret = NULL;
|
||||
size = size - offset;
|
||||
|
||||
size -= offset;
|
||||
|
||||
if (!initialized) {
|
||||
GST_DEBUG_CATEGORY_INIT (mpegvideo_parser_debug, "codecparsers_mpegvideo",
|
||||
|
@ -388,9 +389,11 @@ gst_mpeg_video_parse_sequence_header (GstMpegVideoSequenceHdr * seqhdr,
|
|||
{
|
||||
GstBitReader br;
|
||||
|
||||
size = size - offset;
|
||||
g_return_val_if_fail (seqhdr != NULL, FALSE);
|
||||
|
||||
if (size - offset < 4)
|
||||
size -= offset;
|
||||
|
||||
if (size < 4)
|
||||
return FALSE;
|
||||
|
||||
gst_bit_reader_init (&br, &data[offset], size);
|
||||
|
@ -415,7 +418,9 @@ gst_mpeg_video_parse_sequence_extension (GstMpegVideoSequenceExt * seqext,
|
|||
{
|
||||
GstBitReader br;
|
||||
|
||||
size = size - offset;
|
||||
g_return_val_if_fail (seqext != NULL, FALSE);
|
||||
|
||||
size -= offset;
|
||||
|
||||
if (size < 6) {
|
||||
GST_DEBUG ("not enough bytes to parse the extension");
|
||||
|
@ -482,7 +487,9 @@ gst_mpeg_video_parse_quant_matrix_extension (GstMpegVideoQuantMatrixExt * quant,
|
|||
guint8 i;
|
||||
GstBitReader br;
|
||||
|
||||
size = size - offset;
|
||||
g_return_val_if_fail (quant != NULL, FALSE);
|
||||
|
||||
size -= offset;
|
||||
|
||||
if (size < 1) {
|
||||
GST_DEBUG ("not enough bytes to parse the extension");
|
||||
|
@ -553,7 +560,9 @@ gst_mpeg_video_parse_picture_extension (GstMpegVideoPictureExt * ext,
|
|||
{
|
||||
GstBitReader br;
|
||||
|
||||
size = size - offset;
|
||||
g_return_val_if_fail (ext != NULL, FALSE);
|
||||
|
||||
size -= offset;
|
||||
|
||||
if (size < 4)
|
||||
return FALSE;
|
||||
|
@ -724,7 +733,9 @@ gst_mpeg_video_parse_gop (GstMpegVideoGop * gop, guint8 * data,
|
|||
{
|
||||
GstBitReader br;
|
||||
|
||||
size = size - offset;
|
||||
g_return_val_if_fail (gop != NULL, FALSE);
|
||||
|
||||
size -= offset;
|
||||
|
||||
if (size < 4)
|
||||
return FALSE;
|
||||
|
|
Loading…
Reference in a new issue