From 702c055645969a53c1837327dcd296fcb08addce Mon Sep 17 00:00:00 2001 From: Alessandro Decina Date: Tue, 6 Dec 2011 12:55:26 +0100 Subject: [PATCH] codecparsers: fix compile warnings in gstmpeg4parser.c --- gst-libs/gst/codecparsers/gstmpeg4parser.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/gst-libs/gst/codecparsers/gstmpeg4parser.c b/gst-libs/gst/codecparsers/gstmpeg4parser.c index f22ba91..12c63b0 100644 --- a/gst-libs/gst/codecparsers/gstmpeg4parser.c +++ b/gst-libs/gst/codecparsers/gstmpeg4parser.c @@ -430,8 +430,8 @@ gst_mpeg4_parse (GstMpeg4Packet * packet, gboolean skip_user_data, g_return_val_if_fail (packet != NULL, GST_MPEG4_PARSER_ERROR); if (size - offset <= 4) { - GST_DEBUG ("Can't parse, buffer is to small size %d at offset %d", size, - offset); + GST_DEBUG ("Can't parse, buffer is to small size %" G_GSSIZE_FORMAT + " at offset %d", size, offset); return GST_MPEG4_PARSER_ERROR; } @@ -479,7 +479,7 @@ find_end: packet->size = (gsize) off2 - off1 - 3; - GST_DEBUG ("Complete packet of type %x found at: %d, Size: %d", + GST_DEBUG ("Complete packet of type %x found at: %d, Size: %" G_GSSIZE_FORMAT, packet->type, packet->offset, packet->size); return GST_MPEG4_PARSER_OK; @@ -511,8 +511,8 @@ gst_h263_parse (GstMpeg4Packet * packet, g_return_val_if_fail (packet != NULL, GST_MPEG4_PARSER_ERROR); if (size - offset < 3) { - GST_DEBUG ("Can't parse, buffer is to small size %d at offset %d", size, - offset); + GST_DEBUG ("Can't parse, buffer is to small size %" G_GSSIZE_FORMAT + " at offset %d", size, offset); return GST_MPEG4_PARSER_ERROR; } @@ -537,7 +537,7 @@ gst_h263_parse (GstMpeg4Packet * packet, packet->size = (gsize) off2 - off1; - GST_DEBUG ("Complete packet found at: %d, Size: %d", + GST_DEBUG ("Complete packet found at: %d, Size: %" G_GSSIZE_FORMAT, packet->offset, packet->size); return GST_MPEG4_PARSER_OK; @@ -953,10 +953,15 @@ gst_mpeg4_parse_video_object_layer (GstMpeg4VideoObjectLayer * vol, &vol->par_height); } else { + gint v; + READ_UINT8 (&br, vol->par_width, 8); - CHECK_ALLOWED (vol->par_width, 1, 255); + v = vol->par_width; + CHECK_ALLOWED (v, 1, 255); + READ_UINT8 (&br, vol->par_height, 8); - CHECK_ALLOWED (vol->par_height, 1, 255); + v = vol->par_height; + CHECK_ALLOWED (v, 1, 255); } GST_DEBUG ("Pixel aspect ratio %d/%d", vol->par_width, vol->par_width); @@ -1023,7 +1028,11 @@ gst_mpeg4_parse_video_object_layer (GstMpeg4VideoObjectLayer * vol, MARKER_UNCHECKED (&br); vol->vop_time_increment_resolution = gst_bit_reader_get_bits_uint16_unchecked (&br, 16); - CHECK_ALLOWED (vol->vop_time_increment_resolution, 1, G_MAXUINT16); + if (vol->vop_time_increment_resolution < 1) { + GST_WARNING ("value not in allowed range. value: %d, range %d-%d", + vol->vop_time_increment_resolution, 1, G_MAXUINT16); + goto failed; + } vol->vop_time_increment_bits = g_bit_storage (vol->vop_time_increment_resolution); -- 2.7.4