diff options
author | James Almer <jamrial@gmail.com> | 2019-02-10 23:41:38 +0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2019-02-10 23:43:26 +0300 |
commit | 3e8b8b6b509c8c37defd3a8c32883fa54bc00de8 (patch) | |
tree | 674200ebb02f1524b0ddc373ff50c10ee1a53861 /libavcodec/cbs_av1.c | |
parent | 6de396c2168e944a854e29766c5ddd9d2d4a20a8 (diff) |
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>
Diffstat (limited to 'libavcodec/cbs_av1.c')
-rw-r--r-- | libavcodec/cbs_av1.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libavcodec/cbs_av1.c b/libavcodec/cbs_av1.c index f70ff1c94f..02f168b58d 100644 --- a/libavcodec/cbs_av1.c +++ b/libavcodec/cbs_av1.c @@ -1067,8 +1067,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; } |