From c5023baecf46487c05efdd94ee4c7f3b7e588439 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sun, 3 Oct 2010 15:55:22 +0200 Subject: [PATCH] vdpau: Check return values of the bitreader functions --- sys/vdpau/mpeg/gstvdpmpegdec.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/sys/vdpau/mpeg/gstvdpmpegdec.c b/sys/vdpau/mpeg/gstvdpmpegdec.c index a0be548efb..3263e6ec7e 100644 --- a/sys/vdpau/mpeg/gstvdpmpegdec.c +++ b/sys/vdpau/mpeg/gstvdpmpegdec.c @@ -408,14 +408,14 @@ gst_vdp_mpeg_dec_parse_data (GstBaseVideoDecoder * base_video_decoder, GstVdpMpegFrame *mpeg_frame; GstFlowReturn ret = GST_FLOW_OK; GstBitReader b_reader = GST_BIT_READER_INIT_FROM_BUFFER (buf); - guint32 sync_code; guint8 start_code; /* skip sync_code */ - gst_bit_reader_get_bits_uint32 (&b_reader, &sync_code, 8 * 3); + gst_bit_reader_skip (&b_reader, 8 * 3); /* start_code */ - gst_bit_reader_get_bits_uint8 (&b_reader, &start_code, 8); + if (!gst_bit_reader_get_bits_uint8 (&b_reader, &start_code, 8)) + return GST_FLOW_ERROR; mpeg_frame = GST_VDP_MPEG_FRAME_CAST (frame); @@ -464,7 +464,11 @@ gst_vdp_mpeg_dec_parse_data (GstBaseVideoDecoder * base_video_decoder, guint8 ext_code; /* ext_code */ - gst_bit_reader_get_bits_uint8 (&b_reader, &ext_code, 4); + if (!gst_bit_reader_get_bits_uint8 (&b_reader, &ext_code, 4)) { + ret = GST_FLOW_ERROR; + gst_buffer_unref (buf); + goto done; + } GST_DEBUG_OBJECT (mpeg_dec, "MPEG_PACKET_EXTENSION: %d", ext_code);