[FFmpeg-cvslog] avcodec/ratecontrol: Fix wrong sizeof expression

Andreas Rheinhardt git at videolan.org
Wed May 21 04:27:13 EEST 2025


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Tue May  6 13:39:45 2025 +0200| [a6f7b320851ad00bdc7802a6876c1eb118394d0c] | committer: Andreas Rheinhardt

avcodec/ratecontrol: Fix wrong sizeof expression

Fixes Coverity issue #1644200.
Introduced in 89a8033fc918b2f0ef435e5a3077455ceb8ff913.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

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

 libavcodec/ratecontrol.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/ratecontrol.c b/libavcodec/ratecontrol.c
index 06d998efcb..3dc44683d0 100644
--- a/libavcodec/ratecontrol.c
+++ b/libavcodec/ratecontrol.c
@@ -699,7 +699,7 @@ av_cold int ff_rate_control_init(MPVMainEncContext *const m)
     if (s->adaptive_quant) {
         unsigned mb_array_size = s->c.mb_stride * s->c.mb_height;
 
-        rcc->cplx_tab = av_malloc_array(mb_array_size, 2 * sizeof(rcc->cplx_tab));
+        rcc->cplx_tab = av_malloc_array(mb_array_size, 2 * sizeof(*rcc->cplx_tab));
         if (!rcc->cplx_tab)
             return AVERROR(ENOMEM);
         rcc->bits_tab = rcc->cplx_tab + mb_array_size;



More information about the ffmpeg-cvslog mailing list