aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDai, Jianhui J <jianhui.j.dai-at-intel.com@ffmpeg.org>2024-03-19 06:05:17 +0000
committerRonald S. Bultje <rsbultje@gmail.com>2024-03-26 09:05:04 -0400
commit61afe4d98ce62d9dfc6f0548e18730ba2f621cc2 (patch)
treec23251f5d33ba55c272533a882f3aca48a849b41
parent63dea3c1e10a0692bbdadd0916335bbf9dc8147d (diff)
downloadffmpeg-61afe4d98ce62d9dfc6f0548e18730ba2f621cc2.tar.gz
avcodec/cbs_vp8: Improve the bitstream position check
The VP8 compressed header may not be byte-aligned due to boolean coding. Round up byte count for accurate data positioning. Signed-off-by: Jianhui Dai <jianhui.j.dai@intel.com> Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
-rw-r--r--libavcodec/cbs_vp8.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavcodec/cbs_vp8.c b/libavcodec/cbs_vp8.c
index afa2e4f980..1f80f34faf 100644
--- a/libavcodec/cbs_vp8.c
+++ b/libavcodec/cbs_vp8.c
@@ -339,7 +339,9 @@ static int cbs_vp8_read_unit(CodedBitstreamContext *ctx,
return err;
pos = get_bits_count(&gbc);
- pos /= 8;
+ // Position may not be byte-aligned after compressed header; Round up byte
+ // count for accurate data positioning.
+ pos = (pos + 7) / 8;
av_assert0(pos <= unit->data_size);
frame->data_ref = av_buffer_ref(unit->data_ref);