[FFmpeg-cvslog] avcodec/sonic: Don't hardcode sizeof(int) == 4

Andreas Rheinhardt git at videolan.org
Wed Nov 4 23:00:37 EET 2020


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Sun Nov  1 14:52:49 2020 +0100| [63f5f01226ff0d335ce1c2005fb73eaa05742741] | committer: Andreas Rheinhardt

avcodec/sonic: Don't hardcode sizeof(int) == 4

Reviewed-by: Michael Niedermayer <michael at niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>

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

 libavcodec/sonic.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/sonic.c b/libavcodec/sonic.c
index bca1eca27a..88d7672bf2 100644
--- a/libavcodec/sonic.c
+++ b/libavcodec/sonic.c
@@ -509,7 +509,7 @@ static int modified_levinson_durbin(int *window, int window_entries,
     if (!state)
         return AVERROR(ENOMEM);
 
-    memcpy(state, window, 4* window_entries);
+    memcpy(state, window, window_entries * sizeof(*state));
 
     for (i = 0; i < out_entries; i++)
     {
@@ -761,7 +761,7 @@ static int sonic_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
             break;
     }
 
-    memset(s->window, 0, 4* s->window_size);
+    memset(s->window, 0, s->window_size * sizeof(*s->window));
 
     for (i = 0; i < s->tail_size; i++)
         s->window[x++] = s->tail[i];



More information about the ffmpeg-cvslog mailing list