[FFmpeg-devel] [PATCH 3/3] avcodec/vc2enc: Check for non negative slice bounds

Michael Niedermayer michael at niedermayer.cc
Tue Jun 1 10:33:15 EEST 2021


Fixes: invalid shifts
Fixes: Ticket 8221

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavcodec/vc2enc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/vc2enc.c b/libavcodec/vc2enc.c
index 2de6d4b17a..f0d2cdf62d 100644
--- a/libavcodec/vc2enc.c
+++ b/libavcodec/vc2enc.c
@@ -982,6 +982,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)
-- 
2.17.1



More information about the ffmpeg-devel mailing list