mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-20 23:36:38 +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;
|
gint off, rsize;
|
||||||
GstByteReader br;
|
GstByteReader br;
|
||||||
GList *ret = NULL;
|
GList *ret = NULL;
|
||||||
size = size - offset;
|
|
||||||
|
size -= offset;
|
||||||
|
|
||||||
if (!initialized) {
|
if (!initialized) {
|
||||||
GST_DEBUG_CATEGORY_INIT (mpegvideo_parser_debug, "codecparsers_mpegvideo",
|
GST_DEBUG_CATEGORY_INIT (mpegvideo_parser_debug, "codecparsers_mpegvideo",
|
||||||
|
@ -388,9 +389,11 @@ gst_mpeg_video_parse_sequence_header (GstMpegVideoSequenceHdr * seqhdr,
|
||||||
{
|
{
|
||||||
GstBitReader br;
|
GstBitReader br;
|
||||||
|
|
||||||
size = size - offset;
|
g_return_val_if_fail (seqhdr != NULL, FALSE);
|
||||||
|
|
||||||
if (size - offset < 4)
|
size -= offset;
|
||||||
|
|
||||||
|
if (size < 4)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
gst_bit_reader_init (&br, &data[offset], size);
|
gst_bit_reader_init (&br, &data[offset], size);
|
||||||
|
@ -415,7 +418,9 @@ gst_mpeg_video_parse_sequence_extension (GstMpegVideoSequenceExt * seqext,
|
||||||
{
|
{
|
||||||
GstBitReader br;
|
GstBitReader br;
|
||||||
|
|
||||||
size = size - offset;
|
g_return_val_if_fail (seqext != NULL, FALSE);
|
||||||
|
|
||||||
|
size -= offset;
|
||||||
|
|
||||||
if (size < 6) {
|
if (size < 6) {
|
||||||
GST_DEBUG ("not enough bytes to parse the extension");
|
GST_DEBUG ("not enough bytes to parse the extension");
|
||||||
|
@ -482,7 +487,9 @@ gst_mpeg_video_parse_quant_matrix_extension (GstMpegVideoQuantMatrixExt * quant,
|
||||||
guint8 i;
|
guint8 i;
|
||||||
GstBitReader br;
|
GstBitReader br;
|
||||||
|
|
||||||
size = size - offset;
|
g_return_val_if_fail (quant != NULL, FALSE);
|
||||||
|
|
||||||
|
size -= offset;
|
||||||
|
|
||||||
if (size < 1) {
|
if (size < 1) {
|
||||||
GST_DEBUG ("not enough bytes to parse the extension");
|
GST_DEBUG ("not enough bytes to parse the extension");
|
||||||
|
@ -553,7 +560,9 @@ gst_mpeg_video_parse_picture_extension (GstMpegVideoPictureExt * ext,
|
||||||
{
|
{
|
||||||
GstBitReader br;
|
GstBitReader br;
|
||||||
|
|
||||||
size = size - offset;
|
g_return_val_if_fail (ext != NULL, FALSE);
|
||||||
|
|
||||||
|
size -= offset;
|
||||||
|
|
||||||
if (size < 4)
|
if (size < 4)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -724,7 +733,9 @@ gst_mpeg_video_parse_gop (GstMpegVideoGop * gop, guint8 * data,
|
||||||
{
|
{
|
||||||
GstBitReader br;
|
GstBitReader br;
|
||||||
|
|
||||||
size = size - offset;
|
g_return_val_if_fail (gop != NULL, FALSE);
|
||||||
|
|
||||||
|
size -= offset;
|
||||||
|
|
||||||
if (size < 4)
|
if (size < 4)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
Loading…
Reference in a new issue