[FFmpeg-devel] [PATCH 3/7] avcodec/sonic: Don't hardcode sizeof(int) == 4

Andreas Rheinhardt andreas.rheinhardt at gmail.com
Tue Nov 3 19:57:31 EET 2020


Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
---
 libavcodec/sonic.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/sonic.c b/libavcodec/sonic.c
index db2c4339a3..a285228bbc 100644
--- a/libavcodec/sonic.c
+++ b/libavcodec/sonic.c
@@ -506,7 +506,7 @@ static void modified_levinson_durbin(int *window, int window_entries,
     int i;
     int *state = window + window_entries;
 
-    memcpy(state, window, 4* window_entries);
+    memcpy(state, window, window_entries * sizeof(*state));
 
     for (i = 0; i < out_entries; i++)
     {
@@ -755,7 +755,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];
-- 
2.25.1



More information about the ffmpeg-devel mailing list