aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2022-07-03 13:31:19 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2022-10-09 21:32:57 +0200
commit2921c393b180d87cf60a6a36a42304cbbe3e6db8 (patch)
treeac8ae357ba36f32bc0bcd0bb495d394e3e23aaf3
parent86cbbd66cd12b162f006f2ea25e860eab6727204 (diff)
downloadffmpeg-2921c393b180d87cf60a6a36a42304cbbe3e6db8.tar.gz
avcodec/ffv1dec: Limit golomb rice coded slices to width 8M
This limit is possibly not reachable due to other restrictions on buffers but the decoder run table is too small beyond this, so explicitly check for it. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit b4431399ec1e10afff458cf1ffae2a75987d725a) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/ffv1dec.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c
index 2ff749ffa4..dddfaed4d5 100644
--- a/libavcodec/ffv1dec.c
+++ b/libavcodec/ffv1dec.c
@@ -188,6 +188,9 @@ static int decode_slice_header(FFV1Context *f, FFV1Context *fs)
|| (unsigned)fs->slice_y + (uint64_t)fs->slice_height > f->height)
return -1;
+ if (fs->ac == AC_GOLOMB_RICE && fs->slice_width >= (1<<23))
+ return AVERROR_INVALIDDATA;
+
for (i = 0; i < f->plane_count; i++) {
PlaneContext * const p = &fs->plane[i];
int idx = get_symbol(c, state, 0);