diff mbox series

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

Message ID 20210601073315.9104-3-michael@niedermayer.cc
State Accepted
Commit f7862e82686b347eb6a9e64fa7ccdf25d5a76b4b
Headers show
Series [FFmpeg-devel,1/3] avcodec/lpc: check for zero err in normalization in compute_lpc_coefs() | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Michael Niedermayer June 1, 2021, 7:33 a.m. UTC
Fixes: invalid shifts
Fixes: Ticket 8221

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

Comments

Michael Niedermayer June 8, 2021, 3:51 p.m. UTC | #1
On Tue, Jun 01, 2021 at 09:33:15AM +0200, Michael Niedermayer wrote:
> Fixes: invalid shifts
> Fixes: Ticket 8221
> 
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/vc2enc.c | 2 ++
>  1 file changed, 2 insertions(+)

will apply

[...]
diff mbox series

Patch

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)