codecparsers: av1: Do not assert in identify_one_obu when check annex b size.

Some buggy stream just writes the wrong temporal unit and frame size in
the stream. We should return failure rather than assert to abort.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1464>
This commit is contained in:
He Junyan 2020-09-28 18:22:08 +08:00 committed by Víctor Manuel Jáquez Leal
parent b511761f70
commit 227d7a9327

View file

@ -697,14 +697,17 @@ gst_av1_parser_identify_one_obu (GstAV1Parser * parser, const guint8 * data,
annex_b_again:
last_pos = 0;
g_assert (*consumed <= size);
if (*consumed > size)
goto error;
if (*consumed == size) {
ret = GST_AV1_PARSER_NO_MORE_DATA;
goto error;
}
gst_bit_reader_init (&br, data + *consumed, size - *consumed);
g_assert (parser->temporal_unit_consumed <= parser->temporal_unit_size);
if (parser->temporal_unit_consumed > parser->temporal_unit_size)
goto error;
if (parser->temporal_unit_consumed &&
parser->temporal_unit_consumed == parser->temporal_unit_size) {
GST_LOG ("Complete a temporal unit of size %d",
@ -729,7 +732,9 @@ gst_av1_parser_identify_one_obu (GstAV1Parser * parser, const guint8 * data,
}
}
g_assert (parser->frame_unit_consumed <= parser->frame_unit_size);
if (parser->frame_unit_consumed > parser->frame_unit_size)
goto error;
if (parser->frame_unit_consumed &&
parser->frame_unit_consumed == parser->frame_unit_size) {
GST_LOG ("Complete a frame unit of size %d", parser->frame_unit_size);
@ -789,7 +794,8 @@ gst_av1_parser_identify_one_obu (GstAV1Parser * parser, const guint8 * data,
}
}
g_assert (*consumed <= size);
if (*consumed > size)
goto error;
if (*consumed == size) {
ret = GST_AV1_PARSER_NO_MORE_DATA;
goto error;