[FFmpeg-cvslog] avcodec/vc2enc: Check for non negative slice bounds

Michael Niedermayer git at videolan.org
Fri Jun 18 22:14:56 EEST 2021


ffmpeg | branch: release/4.4 | Michael Niedermayer <michael at niedermayer.cc> | Mon May 31 21:40:17 2021 +0200| [350bedf7e2892a1201fdfac8260040d8ec4d4c6c] | committer: Michael Niedermayer

avcodec/vc2enc: Check for non negative slice bounds

Fixes: invalid shifts
Fixes: Ticket 8221

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit f7862e82686b347eb6a9e64fa7ccdf25d5a76b4b)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=350bedf7e2892a1201fdfac8260040d8ec4d4c6c
---

 libavcodec/vc2enc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/vc2enc.c b/libavcodec/vc2enc.c
index 7bd2e4c2ab..295cc21dfa 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)



More information about the ffmpeg-cvslog mailing list