Commit 9cbc1fd2 authored by René Stadler's avatar René Stadler

h264parser: add more size checks and improve existing

Don't subtract with unsigned values, that will bite us. Also fix format
specifier in the log message.
parent 9f76573b
......@@ -1166,8 +1166,8 @@ gst_h264_parser_identify_nalu (GstH264NalParser * nalparser,
{
gint off1, off2;
if (size - offset < 4) {
GST_DEBUG ("Can't parse, buffer has too small size %" G_GSSIZE_FORMAT
if (size < offset + 4) {
GST_DEBUG ("Can't parse, buffer has too small size %" G_GSIZE_FORMAT
", offset %u", size, offset);
return GST_H264_PARSER_ERROR;
}
......@@ -1240,6 +1240,12 @@ gst_h264_parser_identify_nalu_avc (GstH264NalParser * nalparser,
{
GstBitReader br;
if (size < offset + nal_length_size) {
GST_DEBUG ("Can't parse, buffer has too small size %" G_GSIZE_FORMAT
", offset %u", size, offset);
return GST_H264_PARSER_ERROR;
}
size = size - offset;
gst_bit_reader_init (&br, data + offset, size);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment