diff mbox series

[FFmpeg-devel,1/3] avcodec/ratecontrol: Avoid floating point division by 0 of mb_num

Message ID 20210528184834.4625-1-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel,1/3] avcodec/ratecontrol: Avoid floating point division by 0 of mb_num
Related show

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 May 28, 2021, 6:48 p.m. UTC
Fixes: Ticket7990
Fixes: CVE-2020-20448

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

Comments

Michael Niedermayer May 28, 2021, 7:44 p.m. UTC | #1
On Fri, May 28, 2021 at 08:48:32PM +0200, Michael Niedermayer wrote:
> Fixes: Ticket7990
> Fixes: CVE-2020-20448
> 
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/ratecontrol.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

please disregard this patch, its already fixed since 55279d699fa64d8eb1185d8db04ab4ed92e8dea2

[...]
diff mbox series

Patch

diff --git a/libavcodec/ratecontrol.c b/libavcodec/ratecontrol.c
index 6b77ccd006..aa146730f4 100644
--- a/libavcodec/ratecontrol.c
+++ b/libavcodec/ratecontrol.c
@@ -241,7 +241,7 @@  static double get_qscale(MpegEncContext *s, RateControlEntry *rce,
     RateControlContext *rcc = &s->rc_context;
     AVCodecContext *a       = s->avctx;
     const int pict_type     = rce->new_pict_type;
-    const double mb_num     = s->mb_num;
+    const double mb_num     = s->mb_num ? s->mb_num : 1;
     double q, bits;
     int i;