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-11 21:23:49 +0200
commit2e36b0d55a9d2fc6e117972372e9e5d3382c3dd7 (patch)
treef028f446cddf16b3bb021f493ff1c0d49333827e
parent5f44a99a603bf3d95d56cd574ea7aee99d43485b (diff)
downloadffmpeg-2e36b0d55a9d2fc6e117972372e9e5d3382c3dd7.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 cdc7d4250d..00d5847cdc 100644
--- a/libavcodec/vc2enc.c
+++ b/libavcodec/vc2enc.c
@@ -1022,6 +1022,8 @@ static av_cold int vc2_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
s->slice_max_bytes = SSIZE_ROUND(s->slice_max_bytes);
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)