1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-03 05:10:03 +02:00

avcodec/cbs_av1: don't call cbs_av1_read_trailing_bits() when no bits remain in the OBU

Reviewed-by: jkqxz
Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 3e8b8b6b50)
This commit is contained in:
James Almer 2019-02-10 17:41:38 -03:00
parent 74700e50bf
commit 33c8009773

View File

@ -1071,8 +1071,12 @@ static int cbs_av1_read_unit(CodedBitstreamContext *ctx,
if (obu->obu_size > 0 &&
obu->header.obu_type != AV1_OBU_TILE_GROUP &&
obu->header.obu_type != AV1_OBU_FRAME) {
err = cbs_av1_read_trailing_bits(ctx, &gbc,
obu->obu_size * 8 + start_pos - end_pos);
int nb_bits = obu->obu_size * 8 + start_pos - end_pos;
if (nb_bits <= 0)
return AVERROR_INVALIDDATA;
err = cbs_av1_read_trailing_bits(ctx, &gbc, nb_bits);
if (err < 0)
return err;
}