audioparsers: Check return value of GstBitReader/GstByteReader

This commit is contained in:
Edward Hervey 2012-04-12 15:47:24 +02:00
parent fe04c885db
commit ba7569028c
3 changed files with 19 additions and 12 deletions

View file

@ -478,7 +478,8 @@ gst_aac_parse_read_loas_config (GstAacParse * aacparse, const guint8 * data,
gst_bit_reader_init (&br, data, avail);
/* skip sync word (11 bits) and size (13 bits) */
gst_bit_reader_skip (&br, 11 + 13);
if (!gst_bit_reader_skip (&br, 11 + 13))
return FALSE;
/* First bit is "use last config" */
if (!gst_bit_reader_get_bits_uint8 (&br, &u8, 1))
@ -547,7 +548,8 @@ gst_aac_parse_read_loas_config (GstAacParse * aacparse, const guint8 * data,
sample_rate, channels, &bits))
return FALSE;
asc_len -= bits;
gst_bit_reader_skip (&br, asc_len);
if (!gst_bit_reader_skip (&br, asc_len))
return FALSE;
}
}
}

View file

@ -865,7 +865,8 @@ gst_flac_parse_handle_streaminfo (GstFlacParse * flacparse, GstBuffer * buffer)
}
/* Skip metadata block header */
gst_bit_reader_skip (&reader, 32);
if (!gst_bit_reader_skip (&reader, 32))
goto error;
if (!gst_bit_reader_get_bits_uint16 (&reader, &flacparse->min_blocksize, 16))
goto error;

View file

@ -385,6 +385,7 @@ gst_wavpack_parse_frame_header (GstWavpackParse * parse, GstBuffer * buf,
GstByteReader br;
WavpackHeader wph = { {0,}, 0, };
GstMapInfo map;
gboolean hdl = TRUE;
g_return_val_if_fail (gst_buffer_get_size (buf) >=
skip + sizeof (WavpackHeader), FALSE);
@ -396,15 +397,18 @@ gst_wavpack_parse_frame_header (GstWavpackParse * parse, GstBuffer * buf,
gst_byte_reader_skip_unchecked (&br, skip + 4);
/* read */
gst_byte_reader_get_uint32_le (&br, &wph.ckSize);
gst_byte_reader_get_uint16_le (&br, &wph.version);
gst_byte_reader_get_uint8 (&br, &wph.track_no);
gst_byte_reader_get_uint8 (&br, &wph.index_no);
gst_byte_reader_get_uint32_le (&br, &wph.total_samples);
gst_byte_reader_get_uint32_le (&br, &wph.block_index);
gst_byte_reader_get_uint32_le (&br, &wph.block_samples);
gst_byte_reader_get_uint32_le (&br, &wph.flags);
gst_byte_reader_get_uint32_le (&br, &wph.crc);
hdl &= gst_byte_reader_get_uint32_le (&br, &wph.ckSize);
hdl &= gst_byte_reader_get_uint16_le (&br, &wph.version);
hdl &= gst_byte_reader_get_uint8 (&br, &wph.track_no);
hdl &= gst_byte_reader_get_uint8 (&br, &wph.index_no);
hdl &= gst_byte_reader_get_uint32_le (&br, &wph.total_samples);
hdl &= gst_byte_reader_get_uint32_le (&br, &wph.block_index);
hdl &= gst_byte_reader_get_uint32_le (&br, &wph.block_samples);
hdl &= gst_byte_reader_get_uint32_le (&br, &wph.flags);
hdl &= gst_byte_reader_get_uint32_le (&br, &wph.crc);
if (!hdl)
GST_WARNING_OBJECT (parse, "Error reading header");
/* dump */
GST_LOG_OBJECT (parse, "size %d", wph.ckSize);