diff --git a/libavcodec/ra144.c b/libavcodec/ra144.c index ed60a157ef..7646ada797 100644 --- a/libavcodec/ra144.c +++ b/libavcodec/ra144.c @@ -109,12 +109,9 @@ static void copy_and_dup(int16_t *target, const int16_t *source, int offset) { source += BUFFERSIZE - offset; - if (offset > BLOCKSIZE) { - memcpy(target, source, BLOCKSIZE*sizeof(*target)); - } else { - memcpy(target, source, offset*sizeof(*target)); + memcpy(target, source, FFMIN(BLOCKSIZE, offset)*sizeof(*target)); + if (offset < BLOCKSIZE) memcpy(target + offset, source, (BLOCKSIZE - offset)*sizeof(*target)); - } } /** inverse root mean square */