summaryrefslogtreecommitdiff
path: root/libavcodec/ffv1dec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2022-07-03 13:31:19 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2022-09-26 16:50:47 +0200
commitf2039a7ba377b598b0af5f110644e76abd879bf2 (patch)
treec04a6ba7591ec64eb41c5909bdb47e66c5155772 /libavcodec/ffv1dec.c
parent6edd2ad5ccc038926bb6d6d0098eabad21246c14 (diff)
downloadffmpeg-f2039a7ba377b598b0af5f110644e76abd879bf2.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>
Diffstat (limited to 'libavcodec/ffv1dec.c')
-rw-r--r--libavcodec/ffv1dec.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c
index 8516fef5d7..5a365a5e31 100644
--- a/libavcodec/ffv1dec.c
+++ b/libavcodec/ffv1dec.c
@@ -185,6 +185,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);