aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-05-31 21:40:17 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2021-09-09 13:54:52 +0200
commit68765c25cd1534e685477c7bc21dbed5be979a8d (patch)
tree2df07aad38e505b332424f26097862c9611a82bd
parent97d0d3ae61683b000faa67d1260c4bb33fa42f73 (diff)
downloadffmpeg-68765c25cd1534e685477c7bc21dbed5be979a8d.tar.gz
avcodec/vc2enc: Check for non negative slice bounds
Fixes: invalid shifts Fixes: Ticket 8221 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit f7862e82686b347eb6a9e64fa7ccdf25d5a76b4b) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/vc2enc.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavcodec/vc2enc.c b/libavcodec/vc2enc.c
index d0101e01e4..e83442ed55 100644
--- a/libavcodec/vc2enc.c
+++ b/libavcodec/vc2enc.c
@@ -981,6 +981,8 @@ static av_cold int vc2_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
}
s->slice_min_bytes = s->slice_max_bytes - s->slice_max_bytes*(s->tolerance/100.0f);
+ if (s->slice_min_bytes < 0)
+ return AVERROR(EINVAL);
ret = encode_frame(s, avpkt, frame, aux_data, header_size, s->interlaced);
if (ret)