mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
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.
This commit is contained in:
parent
9f76573bda
commit
9cbc1fd23a
1 changed files with 8 additions and 2 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue